public interface ClassSource
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_EXTENSION
Constant extension for class resource names.
|
static char |
CLASS_SEPARATOR_CHAR
Constant class name separation character.
|
static char |
INNER_CLASS_SEPARATOR
Constant for inner classes.
|
static char |
RESOURCE_SEPARATOR_CHAR
Constant resource separation character.
|
static java.lang.String |
RESOURCE_SEPARATOR_STRING
Constant resource separation string.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the class source.
|
void |
closeClassStream(java.lang.String className,
java.io.InputStream inputStream)
Class the input stream which was opened for a specified class.
|
void |
closeResourceStream(java.lang.String className,
java.lang.String resourceName,
java.io.InputStream inputStream)
Class the input stream which was opened for a specified class.
|
java.lang.String |
getCanonicalName()
Answer the canonical name of the class source.
|
int |
getClassExclusionCount()
Answer the count of class resources which were excluded as duplicates
resources for the same class.
|
int |
getClassInclusionCount()
Answer the count of class resources for distinct classes.
|
java.lang.String |
getClassNameFromResourceName(java.lang.String resourceName)
Convert a resource name to a class name.
|
ClassSource_Factory |
getFactory()
The factory used to create this class source.
|
java.lang.String |
getHashText()
A string representation of the class source suitable for logging.
|
Util_InternMap |
getInternMap()
Answer the string intern map of the class source.
|
java.lang.String |
getName()
A name for this class source.
|
ClassSource_Options |
getOptions()
Answer the options of the class source.
|
ClassSource |
getParentSource()
Answer the parent of this class source.
|
int |
getResourceExclusionCount()
Answer the count of resources which were excluded from processing because
they were not class resources.
|
java.lang.String |
getResourceNameFromClassName(java.lang.String className)
Convert a class name to a resource name.
|
int |
getResult(ClassSource_ScanCounts.ResultField resultField)
Answer a specific field from the scan results table.
|
ClassSource_ScanCounts |
getScanResults()
Answer statistics for a scan processing.
|
java.lang.String |
inconvertResourceName(java.lang.String externalResourceName)
Optional API for processing which uses an alternate
form for resources.
|
boolean |
isClassResource(java.lang.String resourceName)
Tell if a specified resource is a class resource.
|
boolean |
isDirectoryResource(java.lang.String resourceName)
Tell if a specified resource is a directory resource.
|
boolean |
isProcessedUsingJandex() |
void |
log(com.ibm.websphere.ras.TraceComponent logger)
Log state information for the class source to a specified
logger.
|
void |
logState()
Log state information for the class source.
|
void |
open()
Open the class source for use.
|
java.io.InputStream |
openClassStream(java.lang.String className)
Open an input stream for a named class.
|
java.io.InputStream |
openResourceStream(java.lang.String className,
java.lang.String resourceName)
Open an input stream for a named class which has a specified resource name.
|
java.lang.String |
outconvertResourceName(java.lang.String internalResourceName)
Optional API for processing which uses an alternate
form for resources.
|
java.lang.String |
resourceAppend(java.lang.String head,
java.lang.String tail)
Perform a resource append operation: This places
a resource separator between the supplied values.
|
void |
scanClasses(ClassSource_Streamer streamer,
java.util.Set<java.lang.String> i_seedClassNamesSet,
ClassSource_Aggregate.ScanPolicy scanPolicy)
Entry point for scanning a class source which is a child of an aggregate
class source.
|
boolean |
scanReferencedClass(java.lang.String referencedClassNam,
ClassSource_Streamer streamer)
Required entry point for scans of referenced classes.
|
boolean |
scanSpecificSeedClass(java.lang.String specificClassName,
ClassSource_Streamer streamer)
Alternate scan processing step: Perform scanning only on specific class.
|
void |
setParentSource(ClassSource classSource)
Set the parent of this class source.
|
static final char RESOURCE_SEPARATOR_CHAR
Constant resource separation character.
static final java.lang.String RESOURCE_SEPARATOR_STRING
Constant resource separation string.
static final char CLASS_SEPARATOR_CHAR
Constant class name separation character.
static final java.lang.String CLASS_EXTENSION
Constant extension for class resource names.
static final char INNER_CLASS_SEPARATOR
Constant for inner classes.
java.lang.String getHashText()
A string representation of the class source suitable for logging. The hash text should include a unique identifier (usually the base hash code of the class source) plus the most relevant descriptive information for the class source.
void logState()
Log state information for the class source.
void log(com.ibm.websphere.ras.TraceComponent logger)
Log state information for the class source to a specified logger. State information uses 'debug' log enablement.
logger
- A logger which is to receive state information.ClassSource_Factory getFactory()
The factory used to create this class source. Other factory based objects created by the class source will use this factory.
ClassSource getParentSource()
Answer the parent of this class source. Answer null if none is set.
void setParentSource(ClassSource classSource)
Set the parent of this class source.
parent
- The parent of this class source.java.lang.String getName()
A name for this class source.
The class source name is used as a unique ID when storing values to
annotation targets. See com.ibm.wsspi.anno.targets.AnnotationTargets_Targets#getClassSourceNames()
.
When adding class sources to an aggregate, the names of the child class sources must be unique.
java.lang.String getCanonicalName()
Answer the canonical name of the class source. All use of the class source uses the canonical name.
ClassSource_Factory.getCanonicalName(String)
ClassSource_Options getOptions()
void open() throws ClassSource_Exception
ClassSource_Exception
- Thrown if the class source could not be opened.void close() throws ClassSource_Exception
ClassSource_Exception
- Thrown if the class source could not be closed.Util_InternMap getInternMap()
Answer the string intern map of the class source.
Class sources intern all class names of scanned classes.
void scanClasses(ClassSource_Streamer streamer, java.util.Set<java.lang.String> i_seedClassNamesSet, ClassSource_Aggregate.ScanPolicy scanPolicy)
Entry point for scanning a class source which is a child of an aggregate class source.
streamer
- A selection and processing helper for the scan operation.i_seedClassNamesSet
- The accumulated seed class names.scanPolicy
- The scan policy of the class source (recorded by the parent).ClassSource_ScanCounts getScanResults()
Answer statistics for a scan processing. (These are only available after scanning is complete.)
int getResult(ClassSource_ScanCounts.ResultField resultField)
Answer a specific field from the scan results table.
resultField
- The scan results field which is to be retrieved.boolean scanSpecificSeedClass(java.lang.String specificClassName, ClassSource_Streamer streamer) throws ClassSource_Exception
Alternate scan processing step: Perform scanning only on specific class.
specificClassNamesThe
- name of the class which is to be scanned.streamer
- A selection and processing helper for the scan operation.ClassSource_Exception
- Thrown in case of an error during scan processing.boolean scanReferencedClass(java.lang.String referencedClassNam, ClassSource_Streamer streamer) throws ClassSource_Exception
Required entry point for scans of referenced classes.
referencedClassNam
- The names of a referenced classes which
requires scanning.streamer
- A selection and processing helper for the scan operation.ClassSource_Exception
- Thrown in case of an error during scan processing.java.lang.String resourceAppend(java.lang.String head, java.lang.String tail)
Perform a resource append operation: This places a resource separator between the supplied values.
head
- The first value to put into the concatenated value.tail
- The second value to put into the concatenated value.boolean isDirectoryResource(java.lang.String resourceName)
Tell if a specified resource is a directory resource. Resources which end with the resource separator are directory resources.
resourceName
- The resource name to test.boolean isClassResource(java.lang.String resourceName)
Tell if a specified resource is a class resource. A resource is a class resource if and only if it has the class extension.
resourceName
- The resource which is to be tested.java.lang.String getClassNameFromResourceName(java.lang.String resourceName)
Convert a resource name to a class name. Conversion strips the class extension and converts all resource separators to class separators. Note that the inner class separator is not changed by the conversion.
resourceName
- The resource to convert to a class name.java.lang.String getResourceNameFromClassName(java.lang.String className)
Convert a class name to a resource name. Conversion changes the class separator to the resource separator and adds the class extension. The inner class separator is not changed by the conversion.
className
- The class name to convert to a resource.java.lang.String inconvertResourceName(java.lang.String externalResourceName)
Optional API for processing which uses an alternate form for resources. For example, directory based processing may change the resource separator to a platform specific separator.
externalResourceName
- The external form of the resource.java.lang.String outconvertResourceName(java.lang.String internalResourceName)
Optional API for processing which uses an alternate form for resources. For example, directory based processing may change the resource separator to a platform specific separator.
internalResourceName
- The internal form of the resource.java.io.InputStream openClassStream(java.lang.String className) throws ClassSource_Exception
Open an input stream for a named class.
Note the distinct cases: If no resource is available for the class, answer null. If a resource is available but cannot be opened, throw an exception.
className
- The name of the class for which to open an input stream.ClassSource_Exception
- Thrown in case a resource is available
for the class, but that resource could not
be opened.java.io.InputStream openResourceStream(java.lang.String className, java.lang.String resourceName) throws ClassSource_Exception
Open an input stream for a named class which has a specified resource name.
This code point is exposed to minimize class name to resource name conversion: Processing which prefers to use the resource name will generate a class name, but should not be forced to discard the resource name.
Note the distinct cases: If no resource is available for the class, answer null. If a resource is available but cannot be opened, throw an exception.
className
- The name of the class for which to open an input stream.ClassSource_Exception
- Thrown in case a resource is available
for the class, but that resource could not
be opened.void closeClassStream(java.lang.String className, java.io.InputStream inputStream) throws ClassSource_Exception
Class the input stream which was opened for a specified class.
className
- The class for which the input stream was opened.inputStream
- The input stream which is to be closed.ClassSource_Exception
- Thrown in case the input stream could not be closed.void closeResourceStream(java.lang.String className, java.lang.String resourceName, java.io.InputStream inputStream) throws ClassSource_Exception
Class the input stream which was opened for a specified class.
This code point is exposed to minimize class name to resource name conversion: Processing which prefers to use the resource name will generate a class name, but should not be forced to discard the resource name.
className
- The class for which the input stream was opened.inputStream
- The input stream which is to be closed.ClassSource_Exception
- Thrown in case the input stream could not be closed.int getResourceExclusionCount()
Answer the count of resources which were excluded from processing because they were not class resources. This includes all container resources and all resources which do not have the class extension.
isClassResource(String)
int getClassExclusionCount()
Answer the count of class resources which were excluded as duplicates resources for the same class. For example, an aggregate class source may contain a resource for the same class in two different child class sources. Only one of these is processed; the others are excluded and will contribute to the exclusion count.
Class resources skipping by the stream are not included in this count.
The class inclusion count plus the class exclusion count add up to the count of all class resources encountered during processing.
Classes from non-seed class sources are not included in either statistic.
getClassInclusionCount()
,
isClassResource(String)
,
ClassSource_Streamer#doProcess(String)
int getClassInclusionCount()
Answer the count of class resources for distinct classes. For example, an aggregate class source may contain a resource for the same class in two different child class sources. The class inclusion count is incremented just once for the entire set of duplicating class resources. The exclusion count is incremented once for each of the other duplicating class resources.
Class resources skipping by the stream are not included in this count.
getClassExclusionCount()
,
isClassResource(String)
,
ClassSource_Streamer#doProcess(String)
boolean isProcessedUsingJandex()