public class ClassContainer extends GenericClassContainer
Modifier and Type | Field and Description |
---|---|
static ClassContainer[] |
EMPTY_ARRAY |
EMPTY_GENERIC_CONTAINER_ARRAY
EMPTY_MODEL_OBJECT_ARRAY
EMPTY_BASE_ARRAY
Constructor and Description |
---|
ClassContainer(ContainerSpecification containerSpec,
Workset aWorkset)
Initialize the new instance with a containser specification and a workset.
|
Modifier and Type | Method and Description |
---|---|
ClassContainer |
addResource(ResourceInformation resourceFile)
Add the given resource file info to the container if it is not yet
present in the list of resources.
|
void |
addSpringConfig(SpringConfigEntity springConfig)
Adds the given spring configuration information to this container.
|
void |
changeAlias(java.lang.String aliasName)
Sets the alias of this container.
|
void |
changeThirdPartyFlag(boolean isThirdPartyLibrary)
Sets whether or not this container is a third party library
|
void |
close()
Closes the underlying classpath element if it is an archive.
|
java.lang.String |
displayString(org.pfsw.bif.text.IStringFilter folderFilter)
Returns the name of this container for display.
|
protected org.pfsw.text.Version |
extractVersion(org.pfsw.settings.ReadOnlySettings settings,
java.lang.String section) |
java.util.List<ResourceInformation> |
findResourceInfos(IStringChecker nameFilter)
Returns a list with all resources matching the given filter.
|
java.util.List<ResourceInformation> |
findResourceInfos(ResourceInformationFilter filter)
Returns a list with all resources matching the given filter.
|
java.util.List<SpringConfigEntity> |
findSpringConfigurations(java.util.function.Predicate<SpringConfigEntity> filter)
Returns all contained spring configuration object that match the given filter.
|
java.lang.String |
getClassesFolderName()
Returns the name of sub-folder in which class files of this container
can be found.
|
ContainerSpecification |
getContainerSpecificationElement() |
java.lang.String |
getDisplayName()
Returns the name of this container that is best for displaying.
|
ClassInformation |
getMainClass() |
protected java.lang.String |
getMainSection(org.pfsw.settings.ReadOnlySettings settings) |
java.lang.String |
getManifestContent() |
int |
getNumberOfContainedResources()
Returns how many resource files are held by this container.
|
java.lang.String |
getPhysicalName()
Returns the name of the containser's physical representation on
the file system.
|
java.util.List<ResourceInformation> |
getResourceFiles()
Returns a (perhaps empty) list of file infos describing the
resources contained in this container.
|
ResourceInformation |
getResourceInfo(java.lang.String resourceName)
Returns the ResourceInformation object corresponding to the given resource name
or null if no such resource can be found in this container.
|
protected java.util.List<ResourceInformation> |
getResources() |
protected java.util.List<SpringConfigEntity> |
getSpringConfigurations() |
IStringChecker |
getSubDirExcludeFilter()
Returns a filter for (relative) sub directory paths that should be
excluded from this container's class and resource files analysis.
|
boolean |
getThirdPartyFlag() |
org.pfsw.text.Version |
getVersion()
Returns the version of this container or null if no version is assigned
to this container.
|
protected org.pfsw.text.Version |
getVersionFromManifest() |
boolean |
hasMainClass()
Returns true if this container has a Main-Class declared in its manifest.
|
protected boolean |
hasParsedManifest() |
protected void |
hasParsedManifest(boolean newValue) |
boolean |
hasResourceFiles()
Returns true if this container contains at least one resource file.
|
protected void |
initFromContainerSpecificationElement(ContainerSpecification containerSpec) |
boolean |
isArchive()
Returns true if the container is actually an archive.
|
boolean |
isDirectory()
Returns true if the container is actually a directory.
|
boolean |
isInitializable()
Returns true if this class container can be initialized
|
boolean |
isMetaData()
Returns true if this class container is defined by meta data rather
than binary files.
|
boolean |
isPhysicalArchive()
Returns true if the container's current physical file system representation
is an archive.
|
boolean |
isPhysicalDirectory()
Returns true if the container's current physical file system representation
is a directory.
|
boolean |
isThirdPartyLibrary()
Returns true if this container represents a third party library.
|
boolean |
isValid()
Returns true if this class container is valid, that is it exists and can
be read from.
|
java.io.InputStream |
openClassFile(ClassInformation classInfo)
Opens the class file that corresponds to the given class information
in this container and returns the input stream.
|
protected void |
parseManifest() |
boolean |
processResourceInformationObjects(IResourceInformationProcessor processor)
Calls the given processor for each contained resource info object.
|
boolean |
processSpringBeans(ISpringBeanProcessor beanProcessor)
Calls the given processor for each contained spring bean object.
|
void |
releaseExternalResources()
Default implementation is doing nothing.
|
void |
reset()
Resets the internal state.
|
protected void |
setContainerSpecificationElement(ContainerSpecification newValue) |
protected void |
setMainClass(ClassInformation newValue) |
void |
setManifestContent(java.lang.String newValue) |
void |
setThirdPartyFlag(boolean isThirdPartyLibrary)
Sets whether or not this container is a third party library
|
protected void |
setVersionFromManifest(org.pfsw.text.Version newValue) |
java.lang.String |
shortDisplayString(org.pfsw.bif.text.IStringFilter folderFilter)
Returns the short name of this container for display.
|
accept, acceptContainers, acceptNamespaces, acceptTypes, addPackage, addSubContainer, calculateContentHash, canHaveDependencies, collectReferredContainers, compareTo, contains, createPackage, equals, filterCorrectType, filterCorrectType, findClassInfo, findOrCreateClassInfo, findOrCreatePackage, findPackage, findPackage, getAlias, getAllContainedClasses, getAnalyzableElementType, getChildCount, getChildren, getClassification, getClassPackages, getContainedIn, getContainerNames, getContentHash, getContext, getDirectReferredContainers, getHighestClassFileVersion, getIncludedContainers, getName, getNamespaces, getNumberOfContainedClasses, getNumberOfContainedPackages, getPackageNamed, getPackages, getParent, getParentContainer, getQualifiedName, getReferredContainers, getRequiredClassFileVersion, getSimpleName, getSubContainers, getWorkset, hashCode, hasParent, hasVersion, initHighestClassFileVersion, inspectString, isNotFoundContainer, isShortContainerNamesOn, isSoftwareComponent, packages, packages, packagesCollected, packagesCollected, processClassInformationObjects, processClassPackageObjects, refersTo, release, removeSubContainer, setAlias, setClassification, setContainedIn, setContainerNames, setContentHash, setHighestClassFileVersion, setIncludedContainers, setReferredContainers, setWorkset, toString
canBeAnalyzedForDependencies
apply, applyOnChildren, applyOnStack, applySelf, coll, countAllElementsRecursivly, getNumberOfAncestors, getOtherProperties, getProperty, getPropertyNames, setOtherProperties, setProperty, str, visitStackObjects
public static final ClassContainer[] EMPTY_ARRAY
public ClassContainer(ContainerSpecification containerSpec, Workset aWorkset)
public java.lang.String getDisplayName()
GenericClassContainer
getDisplayName
in class GenericClassContainer
public java.lang.String getPhysicalName()
public java.lang.String getClassesFolderName()
public IStringChecker getSubDirExcludeFilter()
public java.io.InputStream openClassFile(ClassInformation classInfo) throws java.io.IOException
Returns null if the class is not part of this container.
java.io.IOException
public ClassInformation getMainClass()
public boolean isThirdPartyLibrary()
isThirdPartyLibrary
in class GenericClassContainer
public boolean isInitializable()
public boolean isValid()
isValid
in class GenericClassContainer
public boolean isMetaData()
public boolean isArchive()
isPhysicalArchive()
public boolean isDirectory()
public boolean isPhysicalArchive()
isArchive()
,
isPhysicalDirectory()
public boolean isPhysicalDirectory()
isArchive()
,
isPhysicalArchive()
,
isDirectory()
public boolean hasMainClass()
public void close()
public java.lang.String displayString(org.pfsw.bif.text.IStringFilter folderFilter)
displayString
in class GenericClassContainer
folderFilter
- A filter for the trailing folder names that must be retained for displayGenericClassContainer.isShortContainerNamesOn()
public java.lang.String shortDisplayString(org.pfsw.bif.text.IStringFilter folderFilter)
folderFilter
- A filter for the trailing folder names that must be retained for displaypublic void reset()
public void changeThirdPartyFlag(boolean isThirdPartyLibrary)
public void changeAlias(java.lang.String aliasName)
public org.pfsw.text.Version getVersion()
GenericClassContainer
getVersion
in class GenericClassContainer
public ContainerSpecification getContainerSpecificationElement()
public boolean getThirdPartyFlag()
public void setThirdPartyFlag(boolean isThirdPartyLibrary)
public java.lang.String getManifestContent()
public void setManifestContent(java.lang.String newValue)
public void releaseExternalResources()
GenericClassContainer
releaseExternalResources
in class GenericClassContainer
public java.util.List<ResourceInformation> getResourceFiles()
Be aware that the "META-INF/MANIFEST.MF" is not included in this list.
It can be separately access via getManifestContent()
.
public int getNumberOfContainedResources()
public boolean hasResourceFiles()
public ClassContainer addResource(ResourceInformation resourceFile)
public ResourceInformation getResourceInfo(java.lang.String resourceName)
resourceName
- The resource name, that is the relative path inside the container (must not be null).public java.util.List<ResourceInformation> findResourceInfos(IStringChecker nameFilter)
public java.util.List<ResourceInformation> findResourceInfos(ResourceInformationFilter filter)
public boolean processResourceInformationObjects(IResourceInformationProcessor processor)
processor
- The processor that will be called for each contained resource object (must not be null).public boolean processSpringBeans(ISpringBeanProcessor beanProcessor)
beanProcessor
- The processor that will be called for each contained spring bean object (must not be null).public java.util.List<SpringConfigEntity> findSpringConfigurations(java.util.function.Predicate<SpringConfigEntity> filter)
public void addSpringConfig(SpringConfigEntity springConfig)
protected void parseManifest()
protected java.lang.String getMainSection(org.pfsw.settings.ReadOnlySettings settings)
protected org.pfsw.text.Version extractVersion(org.pfsw.settings.ReadOnlySettings settings, java.lang.String section)
protected void initFromContainerSpecificationElement(ContainerSpecification containerSpec)
protected void setContainerSpecificationElement(ContainerSpecification newValue)
protected void setMainClass(ClassInformation newValue)
protected org.pfsw.text.Version getVersionFromManifest()
protected void setVersionFromManifest(org.pfsw.text.Version newValue)
protected boolean hasParsedManifest()
protected void hasParsedManifest(boolean newValue)
protected java.util.List<ResourceInformation> getResources()
protected java.util.List<SpringConfigEntity> getSpringConfigurations()