public class ClassInformation extends AAnalyzableElement implements org.pfsw.odem.IType
Modifier and Type | Field and Description |
---|---|
static ClassInformation[] |
EMPTY_ARRAY |
static java.lang.String |
JAVA_MODULE_INFO_CLASS_NAME |
EMPTY_MODEL_OBJECT_ARRAY
EMPTY_BASE_ARRAY
Modifier | Constructor and Description |
---|---|
protected |
ClassInformation(java.lang.String className,
ClassPackage containingPackage)
Initialize the new instance with the fully qualified class name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(org.pfsw.odem.IExplorableElementVisitor visitor)
Implementation of the visitor pattern (GOF) for all derived interfaces
if IExplorableElement.
|
boolean |
acceptTypes(org.pfsw.odem.ITypesVisitor visitor)
Invokes the visitors callback method for this type.
|
void |
addDependency(ClassInformationDependency dependency)
Add the given dependency to the internal dependency set.
|
void |
addInjectedDependency(IInjectedDependency dependency)
Adds the given injection dependency to the list of
injection dependencies if it is not yet in the list.
|
void |
addInterface(ClassInformation classInfo)
Adds the given class information to the list of directly extended
or implemented interfaces if it is not yet in the list.
|
void |
addReferredClass(ClassInformation classInfo)
Adds the given class information to the list of referred classes if
it is not yet in the list.
|
void |
beAnnotationType()
Set the type to TypeClassification.ANNOTATION
|
void |
beClassType()
Set the type to TypeClassification.CLASS
|
void |
beEnumType()
Set the type to TypeClassification.ENUM
|
void |
beInterfaceType()
Set the type to TypeClassification.INTERFACE
|
boolean |
canExtendClass()
Returns true if this class info can extend another class (which is the case for class types only).
|
boolean |
canExtendInterfaces()
Returns true if this class info can extend interfaces (which is the case for interface and annotation types).
|
boolean |
canHaveDependencies()
Returns if this object potentially has dependencies to other objects.
|
boolean |
canImplementInterfaces()
Returns true if this class info can implement interfaces (which is the case for class and enum types).
|
protected ClassPackage |
classPackage() |
protected void |
classPackage(ClassPackage newValue) |
protected CollectionUtil |
coll() |
void |
collectReferredPackages(java.util.Collection<ClassPackage> collection)
Adds all packages of the directly referred classes to the given collection.
|
int |
compareTo(AModelObject obj) |
protected org.pfsw.odem.DependencySet<ClassInformation,ClassInformation> |
dependencies() |
boolean |
equals(java.lang.Object obj) |
ClassInformation[] |
getAllContainedClasses()
Returns all classes that are contained in this element or any of its
structural sub-elements.
|
AnalyzableElementType |
getAnalyzableElementType()
Returns the type of the analyzable element.
|
int |
getChildCount()
Returns the current number of children.
|
AModelObject[] |
getChildren()
Returns the children (always an empty array here)
|
ClassContainer |
getClassContainer()
Returns the the container this class was found as
ClassContainer or null if it is not of type ClassContainer.
|
java.lang.Integer |
getClassContentHash()
Returns either null if the hash has not been calculated or a hash value
calculated for underlying class file contents.
|
java.lang.String |
getClassFileName()
Returns the name of the file corresponding to this class (including the
full sub directory path representing the package).
|
ClassFileVersion |
getClassFileVersion()
Returns the version of the underlying class file.
|
org.pfsw.odem.TypeClassification |
getClassification()
Returns whether is is a class an interface an enum or annotation.
|
protected IClassInitializer |
getClassInitializer() |
java.lang.String |
getClassName()
Returns the fully qualified name of the class
|
int |
getClassNameHash() |
ClassPackage |
getClassPackage()
Returns the package object that contains this class
|
GenericClassContainer |
getContainer()
Returns the the container this class was found in.
|
java.lang.String |
getContainerName()
Returns the name of the container this class is located in
|
org.pfsw.odem.IExplorationContext |
getContext()
Returns the context of this object
|
protected int |
getCurrentState() |
org.pfsw.odem.DependencySet |
getDependencies()
Returns all dependencies to other types.
|
protected ClassInformation[] |
getDirectInterfaces(boolean correctType)
Returns an array of all interfaces directly extended by this interface.
|
ClassInformation[] |
getDirectlyExtendedInterfaces()
Returns an array of all interfaces directly extended by this interface.
|
ClassInformation[] |
getDirectlyImplementedInterfaces()
Returns an array of all interfaces directly implemented by this class (or enum).
|
ClassPackage[] |
getDirectReferredPackages()
Returns all packages this class directly depends on.
|
java.util.Collection<org.pfsw.odem.IType> |
getDirectReferredTypes()
Returns all types this type directly depends on.
|
protected java.util.List<ClassInformation> |
getExtendedOrImplementedInterfaces() |
long |
getFileSize() |
java.util.List<IInjectedDependency> |
getInjectedDependencies()
Returns a (maybe empty but never null) list of dependencies that are loosely
coupled by dependency injection.
|
java.lang.String |
getJustClassName()
Returns the class name without the package name
|
java.lang.String[] |
getModifierNames()
Returns the modifiers of this class as strings.
|
int |
getModifiers()
Returns the modifier bits of the class (see
Modifier ). |
java.lang.String |
getModifierString()
Returns the modifiers as string where the separator is a blank
|
java.lang.String |
getName()
Returns the full qualified name of the class this object represents
|
org.pfsw.odem.INamespace |
getNamespace()
Returns the namespace this type belongs to.
|
java.lang.String |
getPackageName()
Returns the package name of this class.
|
protected AModelObject |
getParent()
Returns the parent model object, which is always a ClassPackage.
|
java.util.List<ClassInformation> |
getReferredClasses()
Returns the types on which this class depends directly.
|
ClassInformation[] |
getReferredClassesArray()
Returns an array with all classes this class directly depends on.
|
protected ClassPackage[] |
getReferredPackages() |
java.lang.String |
getStereotype()
Returns the stereotype (e.g.
|
java.lang.String |
getStereotypeTypeName()
Returns the type (class, interface, annotation, enum) as stereotype name.
|
ClassInformation |
getSuperClass()
Returns the superclass information of this class
|
java.lang.String |
getUnqualifiedName()
Returns the name without the namespace
|
org.pfsw.odem.Visibility |
getVisibility()
Returns the visibility of this type.
|
protected boolean |
getWithMainMethod() |
Workset |
getWorkset()
Returns the workset in which this class information is currently hold
|
boolean |
hasExtendedInterfaces()
Returns true if there is information available directly implemented interfaces.
|
int |
hashCode() |
boolean |
hasImplementedInterfaces()
Returns true if there is information available directly implemented
interfaces.
|
boolean |
hasMainMethod()
Returns true if this is a class with a static main( String[] args ) method.
|
protected boolean |
hasParent()
Returns true if this object has a parent model object.
|
boolean |
hasSuperClass()
Returns true if there is a superclass information available for this
class or interface
|
protected java.lang.String |
inspectString()
Returns a string representation that is more convenient for object
inspection with JOI.
|
boolean |
isAbstract()
Returns whether or not this class is abstract
|
boolean |
isAnnotation()
Returns true if this represents an annotation
|
boolean |
isBinaryAvailable()
Returns true if the binary class file for this class is available,
otherwise false.
|
boolean |
isClass()
Returns true if this represents a class
|
boolean |
isComplete()
Returns true if the class has been completely analyzed
|
boolean |
isContainerClassOf(ClassInformation innerClass)
Returns true if the given class is an inner class of this class.
|
boolean |
isContainerClassOf(java.lang.String innerClassName)
Returns true if the given class name specifies an inner class of this class.
|
boolean |
isCurrentlyAnalyzed()
Returns true if the class is currently analyzed.
|
boolean |
isDirectExtensionOf(ClassInformation classInfo)
Returns true if this class or interface is a direct extension of
the given class or interface.
|
boolean |
isDirectExtensionOf(org.pfsw.odem.IType type)
Returns true if this type extends the given type directly.
|
boolean |
isDirectImplementorOf(ClassInformation interfaceInfo)
Returns true if this class directly implements the given interface.
|
boolean |
isDirectImplementorOf(org.pfsw.odem.IType type)
Returns true if this type directly implements the given type.
|
boolean |
isEnum()
Returns true if this represents an enum.
|
boolean |
isExtensionOf(ClassInformation otherClassInfo)
Returns true if this class or interface is a direct or indirect
extension of the given class or interface.
|
boolean |
isFinal()
Returns whether or not this class is final
|
boolean |
isImplementorOf(ClassInformation interfaceInfo)
Returns true if this class directly or indirectly implementor of
the given interface.
|
boolean |
isInnerClass() |
protected boolean |
isInnerClass(java.lang.String outerClassName,
java.lang.String innerClassName) |
boolean |
isInnerClassOf(ClassInformation outerClass)
Returns true if this class is an inner class of the given class.
|
boolean |
isInnerClassOf(java.lang.String outerClassName)
Returns true if this class is an inner class of the class with
the given name.
|
boolean |
isInterface()
Returns true, if this represents an interface.
|
boolean |
isJavaModuleInfo() |
boolean |
isNotFound()
Returns true if the class has been completely analyzed
|
boolean |
isPublic()
Returns whether or not this class is public
|
boolean |
isSubclassOf(ClassInformation otherClass)
Returns true if the given class is the direct superclass of this class
|
boolean |
isSynthetic()
Returns whether or not this class is synthetic
|
boolean |
isUninitialized()
Returns true if the class is not yet analyzed at all.
|
boolean |
knowsContainer()
Returns true if the class already "knows" the container it was found in.
|
boolean |
loadIfNecessary()
If the dependencies of this class have not yet been initialized then they
will be loaded now.
|
java.io.InputStream |
openClassFile()
Opens the class file that corresponds to this class information and
returns its input stream.
|
boolean |
refersTo(IAnalyzableElement analyzableElement)
Returns true if any of the directly referred classes is identical to
the given one.
|
boolean |
refersToClassNamed(java.lang.String name)
Returns true if any of the referred classes has the same name
as the given one.
|
void |
release() |
void |
setClassContentHash(java.lang.Integer classContentHash) |
void |
setClassFileVersion(ClassFileVersion newValue) |
void |
setClassification(org.pfsw.odem.TypeClassification javaType)
Set the type classification of this class info.
|
void |
setClassInitializer(IClassInitializer newValue) |
protected void |
setClassName(java.lang.String newValue) |
protected void |
setCurrentState(int newValue) |
void |
setFileSize(long newValue) |
void |
setIsInnerClass(boolean newValue) |
void |
setModifiers(int newValue) |
protected void |
setReferredPackages(ClassPackage[] newValue) |
void |
setStateAnalyzing() |
void |
setStateComplete() |
void |
setStateNotFound() |
protected void |
setStereotype(java.lang.String newValue) |
void |
setSuperClass(ClassInformation newValue)
Sets the superclass information of this class
|
protected void |
setType(org.pfsw.odem.TypeClassification javaType) |
void |
setWithMainMethod(boolean newValue) |
protected StringUtil |
str() |
java.lang.String |
toString() |
canBeAnalyzedForDependencies
apply, applyOnChildren, applyOnStack, applySelf, countAllElementsRecursivly, getNumberOfAncestors, getOtherProperties, getProperty, getPropertyNames, setOtherProperties, setProperty, visitStackObjects
public static final ClassInformation[] EMPTY_ARRAY
public static final java.lang.String JAVA_MODULE_INFO_CLASS_NAME
protected ClassInformation(java.lang.String className, ClassPackage containingPackage)
className
- The fully qualified class name (e.g. "java.lang.Integer")java.lang.IllegalArgumentException
- If className is nullpublic java.lang.String getName()
getName
in interface org.pfsw.odem.IExplorationModelObject
getName
in class AModelObject
public boolean canHaveDependencies()
canHaveDependencies
in class AModelObject
public boolean isComplete()
public boolean isNotFound()
public boolean isUninitialized()
public boolean isCurrentlyAnalyzed()
public boolean isBinaryAvailable()
public boolean isClass()
public boolean isInterface()
public boolean isEnum()
public boolean isAnnotation()
public boolean isJavaModuleInfo()
public boolean isInnerClassOf(ClassInformation outerClass)
public boolean isInnerClassOf(java.lang.String outerClassName)
public boolean isContainerClassOf(ClassInformation innerClass)
public boolean isContainerClassOf(java.lang.String innerClassName)
public boolean hasSuperClass()
public boolean hasImplementedInterfaces()
public boolean hasExtendedInterfaces()
public boolean hasMainMethod()
public boolean refersToClassNamed(java.lang.String name)
name
- The name of the class to look forpublic boolean refersTo(IAnalyzableElement analyzableElement)
refersTo
in interface IAnalyzableElement
analyzableElement
- The class to check if this class directly refers to itpublic ClassInformation[] getDirectlyImplementedInterfaces()
public ClassInformation[] getDirectlyExtendedInterfaces()
public boolean isSubclassOf(ClassInformation otherClass)
public boolean isDirectExtensionOf(ClassInformation classInfo)
public boolean isExtensionOf(ClassInformation otherClassInfo)
public boolean isDirectImplementorOf(ClassInformation interfaceInfo)
public boolean isImplementorOf(ClassInformation interfaceInfo)
interfaceInfo
- The interface to be checkedpublic boolean canImplementInterfaces()
public boolean canExtendInterfaces()
public boolean canExtendClass()
public void setStateAnalyzing()
public void setStateComplete()
public void setStateNotFound()
public boolean loadIfNecessary()
public java.io.InputStream openClassFile() throws java.io.IOException
Returns null if the class has no physical representation.
java.io.IOException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public int compareTo(AModelObject obj)
compareTo
in interface java.lang.Comparable<AModelObject>
compareTo
in class AModelObject
Comparable.compareTo(java.lang.Object)
public java.lang.String getClassFileName()
Example: For class "org.apache.xml.Parser" the result would be "org/apache/xml/Parser.class".
public void addDependency(ClassInformationDependency dependency)
public void addReferredClass(ClassInformation classInfo)
public void addInterface(ClassInformation classInfo)
public void addInjectedDependency(IInjectedDependency dependency)
public ClassInformation[] getReferredClassesArray()
public java.lang.String getPackageName()
public java.lang.String getJustClassName()
public java.lang.String getContainerName()
public ClassPackage getClassPackage()
public GenericClassContainer getContainer()
public ClassContainer getClassContainer()
public boolean knowsContainer()
public ClassPackage[] getDirectReferredPackages()
public void collectReferredPackages(java.util.Collection<ClassPackage> collection)
public void beClassType()
public void beInterfaceType()
public void beEnumType()
public void beAnnotationType()
public java.lang.String[] getModifierNames()
public java.lang.String getModifierString()
public boolean isAbstract()
isAbstract
in interface org.pfsw.odem.IType
public boolean isFinal()
isFinal
in interface org.pfsw.odem.IType
public boolean isPublic()
public boolean isSynthetic()
public org.pfsw.odem.Visibility getVisibility()
getVisibility
in interface org.pfsw.odem.IType
public java.lang.String getStereotypeTypeName()
public java.lang.String getStereotype()
public AnalyzableElementType getAnalyzableElementType()
getAnalyzableElementType
in interface IAnalyzableElement
public java.lang.String getClassName()
public int getClassNameHash()
public ClassFileVersion getClassFileVersion()
public void setClassFileVersion(ClassFileVersion newValue)
public java.util.List<ClassInformation> getReferredClasses()
public org.pfsw.odem.TypeClassification getClassification()
getClassification
in interface org.pfsw.odem.IType
public ClassInformation getSuperClass()
public void setSuperClass(ClassInformation newValue)
public int getModifiers()
Modifier
).public void setModifiers(int newValue)
public long getFileSize()
public void setFileSize(long newValue)
public boolean isInnerClass()
public void setIsInnerClass(boolean newValue)
public void setClassInitializer(IClassInitializer newValue)
public void setWithMainMethod(boolean newValue)
public java.lang.Integer getClassContentHash()
public void setClassContentHash(java.lang.Integer classContentHash)
public void release()
release
in interface org.pfsw.bif.lifecycle.IReleasable
public Workset getWorkset()
getWorkset
in interface IAnalyzableElement
getWorkset
in class AModelObject
public int getChildCount()
getChildCount
in class AModelObject
public AModelObject[] getChildren()
getChildren
in class AModelObject
public org.pfsw.odem.IExplorationContext getContext()
getContext
in interface org.pfsw.odem.IExplorationModelObject
public org.pfsw.odem.INamespace getNamespace()
getNamespace
in interface org.pfsw.odem.IType
public java.lang.String getUnqualifiedName()
getUnqualifiedName
in interface org.pfsw.odem.IType
public org.pfsw.odem.DependencySet getDependencies()
getDirectReferredTypes()
.getDependencies
in interface org.pfsw.odem.IType
public ClassInformation[] getAllContainedClasses()
getAllContainedClasses
in interface IAnalyzableElement
public boolean accept(org.pfsw.odem.IExplorableElementVisitor visitor)
accept
in interface org.pfsw.odem.IExplorableElementVisiting
visitor
- The implementor of the vistor interface to be called by this methodpublic boolean acceptTypes(org.pfsw.odem.ITypesVisitor visitor)
acceptTypes
in interface org.pfsw.odem.IExplorableElementVisiting
visitor
- The implementor of the vistor interface to be called by this methodpublic java.util.Collection<org.pfsw.odem.IType> getDirectReferredTypes()
getDirectReferredTypes
in interface org.pfsw.odem.IType
public boolean isDirectExtensionOf(org.pfsw.odem.IType type)
isDirectExtensionOf
in interface org.pfsw.odem.IType
public boolean isDirectImplementorOf(org.pfsw.odem.IType type)
isDirectImplementorOf
in interface org.pfsw.odem.IType
public void setClassification(org.pfsw.odem.TypeClassification javaType)
public java.util.List<IInjectedDependency> getInjectedDependencies()
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean hasParent()
hasParent
in class AModelObject
protected AModelObject getParent()
getParent
in class AModelObject
protected ClassInformation[] getDirectInterfaces(boolean correctType)
protected void setClassName(java.lang.String newValue)
protected boolean isInnerClass(java.lang.String outerClassName, java.lang.String innerClassName)
protected ClassPackage classPackage()
protected void classPackage(ClassPackage newValue)
protected int getCurrentState()
protected void setCurrentState(int newValue)
protected java.util.List<ClassInformation> getExtendedOrImplementedInterfaces()
protected ClassPackage[] getReferredPackages()
protected void setReferredPackages(ClassPackage[] newValue)
protected void setType(org.pfsw.odem.TypeClassification javaType)
protected void setStereotype(java.lang.String newValue)
protected org.pfsw.odem.DependencySet<ClassInformation,ClassInformation> dependencies()
protected IClassInitializer getClassInitializer()
protected boolean getWithMainMethod()
protected java.lang.String inspectString()
protected CollectionUtil coll()
coll
in class AModelObject
protected StringUtil str()
str
in class AModelObject