public class ClassPackage extends AAnalyzableElement implements org.pfsw.odem.INamespace, IClassContainingElement, IStringRepresentation
Modifier and Type | Field and Description |
---|---|
static ClassPackage[] |
EMPTY_ARRAY |
EMPTY_MODEL_OBJECT_ARRAY
EMPTY_BASE_ARRAY
Constructor and Description |
---|
ClassPackage(java.lang.String packageName,
GenericClassContainer packageContainer)
Initialize the new instance with a 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 |
acceptNamespaces(org.pfsw.odem.INamespacesVisitor visitor)
Implementation of the visitor pattern (GOF).
|
boolean |
acceptTypes(org.pfsw.odem.ITypesVisitor visitor)
Iterates over all contained IType objects and invokes the visitor's
callback method using the types as parameter.
|
void |
addClass(ClassInformation classInfo)
Add the given class information to the package.
|
boolean |
canHaveDependencies()
Returns if this object potentially has dependencies to other objects.
|
ClassInformation |
createClassInfo(java.lang.String className)
Creates a new class info with the given fully qualified class name
and adds it to the package.
|
boolean |
equals(java.lang.Object obj)
Returns true if the given object equals this object
|
ClassInformation |
findClassInfo(java.lang.String className)
Returns the classInfo with the given name if it is member or this package.
|
ClassInformation |
findOrCreateClassInfo(java.lang.String className)
Searches for the class info in this container and returns it if found.
|
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
|
protected java.util.List<ClassInformation> |
getClasses() |
protected IClassInformationFactory |
getClassInformationFactory() |
ClassInformation[] |
getClassInfos()
Returns the class information of all classes found in this package.
|
GenericClassContainer |
getContainer()
Returns the container this package resides in
|
java.lang.String |
getContainerName()
Returns the name of the container the package was found in
|
org.pfsw.odem.IExplorationContext |
getContext()
Returns the context of this object
|
ClassPackage[] |
getDirectReferredPackages()
Returns all packages this package directly depends on
|
protected ClassFileVersion |
getHighestClassFileVersion() |
java.lang.String |
getName()
Returns the name.
|
int |
getNumberOfContainedClasses()
Returns the number of classes in this package
|
int |
getNumberOfDirectReferredPackages()
Returns the number of packages this package directly depends on.
|
protected AModelObject |
getParent()
Returns the parent model object, which is always a GenericClassContainer.
|
protected ClassPackage[] |
getReferredPackages() |
ClassFileVersion |
getRequiredClassFileVersion()
Returns the highest class file version that one of the contained classes
is based on.
|
java.lang.String |
getStringRepresentation()
Returns the package name
|
java.util.Collection<org.pfsw.odem.IType> |
getTypes()
Returns all types in this namespace.
|
Workset |
getWorkset()
Returns the workset this element is included in
|
int |
hashCode()
Returns the hash code of this object
|
protected boolean |
hasParent()
Returns true if this object has a parent model object.
|
protected void |
initHighestClassFileVersion() |
protected java.lang.String |
inspectString()
Returns a string representation that is more convenient for object
inspection with JOI.
|
boolean |
isDefaultPackage()
Returns true if this package represents the default package (i.e "")
|
boolean |
knowsContainer()
Returns true, if the package "knows" in which container it was found
|
boolean |
notFound()
Returns true, if the package has not been found in any container
|
boolean |
processClassInformationObjects(java.util.Collection<ClassInformation> collection,
IClassInformationProcessor<?> processor)
Calls the given processor for each contained class info object and
adds all class info objects that the processor wants (i.e.
|
boolean |
refersTo(IAnalyzableElement analyzableElement)
Returns true if any of the directly referred packages is identical to
the given one.
|
void |
release() |
protected void |
reset() |
protected void |
setClasses(java.util.List<ClassInformation> newValue) |
protected void |
setContainer(GenericClassContainer newValue) |
protected void |
setHighestClassFileVersion(ClassFileVersion newValue) |
protected void |
setName(java.lang.String newValue) |
protected void |
setReferredPackages(ClassPackage[] newValue) |
java.lang.String |
toString() |
canBeAnalyzedForDependencies
apply, applyOnChildren, applyOnStack, applySelf, coll, compareTo, countAllElementsRecursivly, getNumberOfAncestors, getOtherProperties, getProperty, getPropertyNames, setOtherProperties, setProperty, str, visitStackObjects
public static final ClassPackage[] EMPTY_ARRAY
public ClassPackage(java.lang.String packageName, GenericClassContainer packageContainer)
packageName
- A valid Java package name (must not be null)packageContainer
- The classpath element that contains the package (must not be null)java.lang.IllegalArgumentException
- If any of the arguments is nullpublic java.lang.String getStringRepresentation()
getStringRepresentation
in interface IStringRepresentation
public boolean canHaveDependencies()
canHaveDependencies
in class AModelObject
public void addClass(ClassInformation classInfo)
public ClassInformation[] getClassInfos()
public java.util.Collection<org.pfsw.odem.IType> getTypes()
getTypes
in interface org.pfsw.odem.INamespace
public java.lang.String getContainerName()
public ClassPackage[] getDirectReferredPackages()
public int getNumberOfDirectReferredPackages()
public boolean refersTo(IAnalyzableElement analyzableElement)
refersTo
in interface IAnalyzableElement
analyzableElement
- The package to check if this package refers to itpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isDefaultPackage()
public boolean knowsContainer()
public boolean notFound()
public ClassInformation findClassInfo(java.lang.String className)
public ClassInformation findOrCreateClassInfo(java.lang.String className)
public ClassInformation createClassInfo(java.lang.String className)
public int getNumberOfContainedClasses()
getNumberOfContainedClasses
in interface IClassContainingElement
public ClassInformation[] getAllContainedClasses()
getAllContainedClasses
in interface IAnalyzableElement
public boolean processClassInformationObjects(java.util.Collection<ClassInformation> collection, IClassInformationProcessor<?> processor)
collection
- The collection to which the matching objects will be added (might be null).processor
- The processor that decides whether or not an object must be added.public ClassFileVersion getRequiredClassFileVersion()
getRequiredClassFileVersion
in interface IClassContainingElement
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 acceptNamespaces(org.pfsw.odem.INamespacesVisitor visitor)
acceptNamespaces
in interface org.pfsw.odem.INamespace
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 AnalyzableElementType getAnalyzableElementType()
getAnalyzableElementType
in interface IAnalyzableElement
public java.lang.String getName()
AModelObject
getName
in interface org.pfsw.odem.IExplorationModelObject
getName
in class AModelObject
public GenericClassContainer getContainer()
public java.lang.String toString()
toString
in class java.lang.Object
public void release()
release
in interface org.pfsw.bif.lifecycle.IReleasable
protected boolean hasParent()
hasParent
in class AModelObject
protected AModelObject getParent()
getParent
in class AModelObject
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
protected void reset()
protected void initHighestClassFileVersion()
protected IClassInformationFactory getClassInformationFactory()
protected void setName(java.lang.String newValue)
protected void setContainer(GenericClassContainer newValue)
protected java.util.List<ClassInformation> getClasses()
protected void setClasses(java.util.List<ClassInformation> newValue)
protected ClassPackage[] getReferredPackages()
protected void setReferredPackages(ClassPackage[] newValue)
protected ClassFileVersion getHighestClassFileVersion()
protected void setHighestClassFileVersion(ClassFileVersion newValue)
protected java.lang.String inspectString()