public abstract class GenericClassContainer extends AAnalyzableElement implements org.pfsw.odem.IContainer, IClassContainingElement
Modifier and Type | Field and Description |
---|---|
static GenericClassContainer[] |
EMPTY_GENERIC_CONTAINER_ARRAY |
EMPTY_MODEL_OBJECT_ARRAY
EMPTY_BASE_ARRAY
Modifier | Constructor and Description |
---|---|
protected |
GenericClassContainer(Workset aWorkset)
Initialize the new instance with default values.
|
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 |
acceptContainers(org.pfsw.odem.IContainersVisitor visitor)
Implementation of the visitor pattern (GOF).
|
boolean |
acceptNamespaces(org.pfsw.odem.INamespacesVisitor visitor)
Implementation of the visitor pattern (GOF).
|
boolean |
acceptTypes(org.pfsw.odem.ITypesVisitor visitor)
Iterates (recursivly) over all contained IType
objects and invokes the visitor's callback method using the types as parameter.
|
protected void |
addPackage(ClassPackage aPackage) |
boolean |
addSubContainer(GenericClassContainer container)
If the given container is not yet in the list of sub containers it will be
added and its parent container will be set to this container.
|
protected void |
calculateContentHash() |
boolean |
canHaveDependencies()
Returns if this object potentially has dependencies to other objects.
|
protected void |
collectReferredContainers(java.util.Collection<GenericClassContainer> result)
Looks for all directly referred containers and adds them to the given
collection.
|
int |
compareTo(AModelObject obj) |
boolean |
contains(ClassInformation classInfo)
Returns true if the class corresponding to the given class info can be
found in this container.
|
ClassPackage |
createPackage(java.lang.String packageName)
Create a new package in this container
|
java.lang.String |
displayString(org.pfsw.bif.text.IStringFilter folderFilter)
Returns the name of this container for display.
|
boolean |
equals(java.lang.Object obj) |
static <T extends GenericClassContainer> |
filterCorrectType(GenericClassContainer[] genericClassContainers,
java.lang.Class<T> containerType)
Returns an array with all containers of the specified containerType from
the given genericClassContainers.
|
static <T extends GenericClassContainer> |
filterCorrectType(java.util.List<GenericClassContainer> genericClassContainers,
java.lang.Class<T> containerType)
Returns an array with all containers of the specified containerType from
the given genericClassContainers.
|
ClassInformation |
findClassInfo(java.lang.String className)
Looks up the classInfo with the given name in all packages this container
holds.
|
ClassInformation |
findOrCreateClassInfo(java.lang.String className)
Searches for the class info in this container and returns it if found.
|
ClassPackage |
findOrCreatePackage(java.lang.String packageName,
boolean duringInit)
Returns the package with the given name.
|
ClassPackage |
findPackage(java.lang.String packageName)
Returns the package with the given name or null if not found in this
container.
|
protected ClassPackage |
findPackage(java.lang.String packageName,
java.util.Collection<ClassPackage> packageCollection)
Returns the package with the given name or null if not found in this
container.
|
java.lang.String |
getAlias()
Returns the alias name of this container or null if none has been specified.
|
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
|
org.pfsw.odem.ContainerClassification |
getClassification() |
protected java.util.List<ClassPackage> |
getClassPackages() |
protected GenericClassContainer |
getContainedIn() |
protected ContainerNames |
getContainerNames() |
java.lang.Integer |
getContentHash()
Returns either null if the hash has not been calculated or a hash value
calculated for underlying classes.
|
org.pfsw.odem.IExplorationContext |
getContext()
Returns the context this container belongs to.
|
GenericClassContainer[] |
getDirectReferredContainers()
Returns all containers that are directly referred by this container
through its contained classes.
|
java.lang.String |
getDisplayName()
Returns the name of this container that is best for displaying.
|
protected ClassFileVersion |
getHighestClassFileVersion() |
java.util.List<GenericClassContainer> |
getIncludedContainers() |
java.lang.String |
getName()
Returns the name.
|
java.util.Collection<org.pfsw.odem.INamespace> |
getNamespaces()
Returns all namespaces found in this container
This method never returns null.
|
int |
getNumberOfContainedClasses()
Returns the number of classes in this container
|
int |
getNumberOfContainedPackages()
Returns the number of packages in this container
|
ClassPackage |
getPackageNamed(java.lang.String packageName)
Returns the package with the given name or null if it cannot be found.
|
ClassPackage[] |
getPackages()
Returns all packages found in this contains
|
protected AModelObject |
getParent()
Returns the parent model object, which is always a Workset.
|
org.pfsw.odem.IContainer |
getParentContainer()
Returns the parent container of this container.
|
java.lang.String |
getQualifiedName()
Returns the qualifying name of this container which
is relative and therefore independent of the actual
file system location.
|
protected GenericClassContainer[] |
getReferredContainers() |
ClassFileVersion |
getRequiredClassFileVersion()
Returns the highest class file version that one of the contained classes
is based on.
|
java.lang.String |
getSimpleName()
Returns the simple name of this container which
does not contain any path or parent container (bundle) name.
|
java.util.Collection<org.pfsw.odem.IContainer> |
getSubContainers()
Returns all sub containers of this container.
|
org.pfsw.text.Version |
getVersion()
Returns the version of this container or null if no version is assigned
to this container.
|
Workset |
getWorkset()
Returns the workset the container is included in
|
int |
hashCode() |
protected boolean |
hasParent()
Returns true if this object has a parent model object.
|
boolean |
hasVersion()
Returns true if this container has a version assigned.
|
protected void |
initHighestClassFileVersion() |
protected java.lang.String |
inspectString()
Returns a string representation that is more convenient for object
inspection with JOI.
|
boolean |
isNotFoundContainer()
Returns true if this is the special container that holds all packages
and classes that have not been found in the workset.
|
boolean |
isShortContainerNamesOn()
Returns true if container names should be shown in a short form.
|
boolean |
isSoftwareComponent()
Returns true if this container represents a modeled software component.
|
boolean |
isThirdPartyLibrary()
Returns true if this container represents a third party library.
|
abstract boolean |
isValid()
Returns true if this class container is valid.
|
protected java.util.List<ClassPackage> |
packages() |
protected void |
packages(java.util.List<ClassPackage> newValue) |
boolean |
packagesCollected()
Returns whether or not this container has been initialized.
|
void |
packagesCollected(boolean collected)
Sets whether or not this container has been initialized.
|
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 to the given collection (if it is not null).
|
boolean |
processClassPackageObjects(java.util.Collection<ClassPackage> collection,
IClassPackageProcessor processor)
Calls the given processor for each contained class package object and
adds all class package objects that the processor wants (matches)
to the given collection if it is not null.
|
boolean |
refersTo(IAnalyzableElement analyzableElement)
Returns true if this container directly depends on the given container.
|
void |
release() |
void |
releaseExternalResources()
Default implementation is doing nothing.
|
protected boolean |
removeSubContainer(GenericClassContainer container)
If the given container is in the list of sub containers it will be
removed and its parent container will be set to null.
|
void |
setAlias(java.lang.String aliasName)
Sets the alias name of this container.
|
protected void |
setClassification(org.pfsw.odem.ContainerClassification newValue) |
protected void |
setContainedIn(GenericClassContainer newValue) |
protected void |
setContainerNames(ContainerNames containerNames) |
void |
setContentHash(java.lang.Integer hash) |
protected void |
setHighestClassFileVersion(ClassFileVersion newValue) |
protected void |
setIncludedContainers(java.util.List<GenericClassContainer> newValue) |
protected void |
setReferredContainers(GenericClassContainer[] newValue) |
protected void |
setWorkset(Workset newValue) |
java.lang.String |
toString() |
canBeAnalyzedForDependencies
apply, applyOnChildren, applyOnStack, applySelf, coll, countAllElementsRecursivly, getNumberOfAncestors, getOtherProperties, getProperty, getPropertyNames, setOtherProperties, setProperty, str, visitStackObjects
public static final GenericClassContainer[] EMPTY_GENERIC_CONTAINER_ARRAY
protected GenericClassContainer(Workset aWorkset)
public static <T extends GenericClassContainer> T[] filterCorrectType(GenericClassContainer[] genericClassContainers, java.lang.Class<T> containerType)
public static <T extends GenericClassContainer> T[] filterCorrectType(java.util.List<GenericClassContainer> genericClassContainers, java.lang.Class<T> containerType)
public abstract boolean isValid()
public org.pfsw.odem.ContainerClassification getClassification()
getClassification
in interface org.pfsw.odem.IContainer
public Workset getWorkset()
getWorkset
in interface IAnalyzableElement
getWorkset
in class AModelObject
public boolean packagesCollected()
public void packagesCollected(boolean collected)
public java.util.List<GenericClassContainer> getIncludedContainers()
public java.lang.String getDisplayName()
public java.lang.String getName()
AModelObject
getName
in interface org.pfsw.odem.IExplorationModelObject
getName
in class AModelObject
public java.lang.String getQualifiedName()
public java.lang.String getSimpleName()
public java.lang.String getAlias()
getAlias
in interface org.pfsw.odem.IAlias
public void setAlias(java.lang.String aliasName)
setAlias
in interface org.pfsw.odem.IAlias
public ClassPackage[] getPackages()
public boolean canHaveDependencies()
canHaveDependencies
in class AModelObject
public boolean isSoftwareComponent()
public boolean isThirdPartyLibrary()
public boolean isShortContainerNamesOn()
public boolean isNotFoundContainer()
public java.lang.String displayString(org.pfsw.bif.text.IStringFilter folderFilter)
folderFilter
- A filter for the trailing folder names that must be retained for displaypublic 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 boolean processClassPackageObjects(java.util.Collection<ClassPackage> collection, IClassPackageProcessor processor)
collection
- The collection to which the matching objects will be added to (may be null).processor
- The processor that decides whether or not an object must be added (must not be null).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 acceptContainers(org.pfsw.odem.IContainersVisitor visitor)
acceptContainers
in interface org.pfsw.odem.IStructureVisiting
visitor
- The implementor of the visitor interface to be called by this methodpublic boolean acceptNamespaces(org.pfsw.odem.INamespacesVisitor visitor)
acceptNamespaces
in interface org.pfsw.odem.IStructureVisiting
visitor
- The implementor of the visitor 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 int getNumberOfContainedPackages()
public int getNumberOfContainedClasses()
getNumberOfContainedClasses
in interface IClassContainingElement
public ClassFileVersion getRequiredClassFileVersion()
getRequiredClassFileVersion
in interface IClassContainingElement
public ClassInformation[] getAllContainedClasses()
getAllContainedClasses
in interface IAnalyzableElement
public ClassInformation findOrCreateClassInfo(java.lang.String className)
public ClassPackage findOrCreatePackage(java.lang.String packageName, boolean duringInit)
packageName
- The name of the package to look forduringInit
- Indicates whether or not this call is during the initialization of the containerpublic ClassPackage findPackage(java.lang.String packageName)
public ClassPackage createPackage(java.lang.String packageName)
public GenericClassContainer[] getDirectReferredContainers()
public boolean refersTo(IAnalyzableElement analyzableElement)
refersTo
in interface IAnalyzableElement
analyzableElement
- The other element to check if this analyzable element directly refers to itpublic ClassInformation findClassInfo(java.lang.String className)
public ClassPackage getPackageNamed(java.lang.String packageName)
public boolean contains(ClassInformation classInfo)
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 toString()
toString
in class java.lang.Object
public org.pfsw.odem.IExplorationContext getContext()
getContext
in interface org.pfsw.odem.IExplorationModelObject
public java.util.Collection<org.pfsw.odem.INamespace> getNamespaces()
getNamespaces
in interface org.pfsw.odem.IContainer
public org.pfsw.odem.IContainer getParentContainer()
getParentContainer
in interface org.pfsw.odem.IContainer
public java.util.Collection<org.pfsw.odem.IContainer> getSubContainers()
getSubContainers
in interface org.pfsw.odem.IContainer
public boolean addSubContainer(GenericClassContainer container)
container
- The container to add as sub containerpublic boolean hasVersion()
public org.pfsw.text.Version getVersion()
public AnalyzableElementType getAnalyzableElementType()
getAnalyzableElementType
in interface IAnalyzableElement
public void releaseExternalResources()
public java.lang.Integer getContentHash()
public void setContentHash(java.lang.Integer hash)
public void release()
release
in interface org.pfsw.bif.lifecycle.IReleasable
public AModelObject[] getChildren()
getChildren
in class AModelObject
public int getChildCount()
getChildCount
in class AModelObject
protected boolean removeSubContainer(GenericClassContainer container)
container
- The container to removeprotected boolean hasParent()
hasParent
in class AModelObject
protected AModelObject getParent()
getParent
in class AModelObject
protected java.util.List<ClassPackage> getClassPackages()
protected void addPackage(ClassPackage aPackage)
protected void packages(java.util.List<ClassPackage> newValue)
protected ClassPackage findPackage(java.lang.String packageName, java.util.Collection<ClassPackage> packageCollection)
protected void collectReferredContainers(java.util.Collection<GenericClassContainer> result)
protected void initHighestClassFileVersion()
protected void calculateContentHash()
protected ContainerNames getContainerNames()
protected void setContainerNames(ContainerNames containerNames)
protected void setWorkset(Workset newValue)
protected java.util.List<ClassPackage> packages()
protected GenericClassContainer getContainedIn()
protected void setContainedIn(GenericClassContainer newValue)
protected void setIncludedContainers(java.util.List<GenericClassContainer> newValue)
protected GenericClassContainer[] getReferredContainers()
protected void setReferredContainers(GenericClassContainer[] newValue)
protected void setClassification(org.pfsw.odem.ContainerClassification newValue)
protected ClassFileVersion getHighestClassFileVersion()
protected void setHighestClassFileVersion(ClassFileVersion newValue)
protected java.lang.String inspectString()