Interface ClassSource
- All Known Subinterfaces:
ClassSource_Aggregate
,ClassSource_ClassLoader
,ClassSource_MappedContainer
,ClassSource_MappedDirectory
,ClassSource_MappedJar
,ClassSource_MappedSimple
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant extension for class resource names.static final char
Constant class name separation character.static final char
Constant for inner classes.static final char
Constant resource separation character.static final String
Constant resource separation string. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the class source.void
closeClassStream
(String className, InputStream inputStream) Class the input stream which was opened for a specified class.void
closeResourceStream
(String className, String resourceName, InputStream inputStream) Class the input stream which was opened for a specified class.Answer the canonical name of the class source.int
Answer the count of class resources which were excluded as duplicates resources for the same class.int
Answer the count of class resources for distinct classes.getClassNameFromResourceName
(String resourceName) Convert a resource name to a class name.The factory used to create this class source.A string representation of the class source suitable for logging.Answer the string intern map of the class source.getName()
A name for this class source.Answer the options of the class source.Answer the parent of this class source.int
Answer the count of resources which were excluded from processing because they were not class resources.getResourceNameFromClassName
(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.Answer statistics for a scan processing.inconvertResourceName
(String externalResourceName) Optional API for processing which uses an alternate form for resources.boolean
isClassResource
(String resourceName) Tell if a specified resource is a class resource.boolean
isDirectoryResource
(String resourceName) Tell if a specified resource is a directory resource.boolean
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.openClassStream
(String className) Open an input stream for a named class.openResourceStream
(String className, String resourceName) Open an input stream for a named class which has a specified resource name.outconvertResourceName
(String internalResourceName) Optional API for processing which uses an alternate form for resources.resourceAppend
(String head, String tail) Perform a resource append operation: This places a resource separator between the supplied values.void
scanClasses
(ClassSource_Streamer streamer, Set<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
(String referencedClassNam, ClassSource_Streamer streamer) Required entry point for scans of referenced classes.boolean
scanSpecificSeedClass
(String specificClassName, ClassSource_Streamer streamer) Alternate scan processing step: Perform scanning only on specific class.void
setParentSource
(ClassSource parent) Set the parent of this class source.
-
Field Details
-
RESOURCE_SEPARATOR_CHAR
static final char RESOURCE_SEPARATOR_CHARConstant resource separation character.
- See Also:
-
RESOURCE_SEPARATOR_STRING
Constant resource separation string.
- See Also:
-
CLASS_SEPARATOR_CHAR
static final char CLASS_SEPARATOR_CHARConstant class name separation character.
- See Also:
-
CLASS_EXTENSION
Constant extension for class resource names.
- See Also:
-
INNER_CLASS_SEPARATOR
static final char INNER_CLASS_SEPARATORConstant for inner classes.
- See Also:
-
-
Method Details
-
getHashText
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.
- Returns:
- A string representation of the class source suitable for logging.
-
logState
void logState()Log state information for the class source.
-
log
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.
- Parameters:
logger
- A logger which is to receive state information.
-
getFactory
ClassSource_Factory getFactory()The factory used to create this class source. Other factory based objects created by the class source will use this factory.
- Returns:
- The factory used to create this class source.
-
getParentSource
ClassSource getParentSource()Answer the parent of this class source. Answer null if none is set.
- Returns:
- The parent of this class source.
-
setParentSource
Set the parent of this class source.
- Parameters:
parent
- The parent of this class source.
-
getName
String getName()A name for this class source.
The class source name is used as a unique ID when storing values to annotation targets.
When adding class sources to an aggregate, the names of the child class sources must be unique.
- Returns:
- A name for this class source.
-
getCanonicalName
String getCanonicalName()Answer the canonical name of the class source. All use of the class source uses the canonical name.
- Returns:
- The canonical name of the class source.
ClassSource_Factory.getCanonicalName(String)
-
getOptions
ClassSource_Options getOptions()Answer the options of the class source.- Returns:
- The options of the class source.
-
open
Open the class source for use. This will open any underlying objects.- Throws:
ClassSource_Exception
- Thrown if the class source could not be opened.
-
close
Close the class source. Close any underlying objects.- Throws:
ClassSource_Exception
- Thrown if the class source could not be closed.
-
getInternMap
Util_InternMap getInternMap()Answer the string intern map of the class source.
Class sources intern all class names of scanned classes.
- Returns:
- The intern map of the class source.
-
scanClasses
void scanClasses(ClassSource_Streamer streamer, Set<String> i_seedClassNamesSet, ClassSource_Aggregate.ScanPolicy scanPolicy) Entry point for scanning a class source which is a child of an aggregate class source.
- Parameters:
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).
-
getScanResults
ClassSource_ScanCounts getScanResults()Answer statistics for a scan processing. (These are only available after scanning is complete.)
- Returns:
- Statistics for scan processing.
-
getResult
Answer a specific field from the scan results table.
- Parameters:
resultField
- The scan results field which is to be retrieved.- Returns:
- The value of the requested scan results field.
-
scanSpecificSeedClass
boolean scanSpecificSeedClass(String specificClassName, ClassSource_Streamer streamer) throws ClassSource_Exception Alternate scan processing step: Perform scanning only on specific class.
- Parameters:
specificClassName
- The name of the class which is to be scanned.streamer
- A selection and processing helper for the scan operation.- Returns:
- True if the streamer processed the class. Otherwise, false.
- Throws:
ClassSource_Exception
- Thrown in case of an error during scan processing.
-
scanReferencedClass
boolean scanReferencedClass(String referencedClassNam, ClassSource_Streamer streamer) throws ClassSource_Exception Required entry point for scans of referenced classes.
- Parameters:
referencedClassNam
- The names of a referenced classes which requires scanning.streamer
- A selection and processing helper for the scan operation.- Returns:
- True if the streamer processed the class. Otherwise, false.
- Throws:
ClassSource_Exception
- Thrown in case of an error during scan processing.
-
resourceAppend
Perform a resource append operation: This places a resource separator between the supplied values.
- Parameters:
head
- The first value to put into the concatenated value.tail
- The second value to put into the concatenated value.- Returns:
- The first value concatenated with a resource separator and with the second value.
-
isDirectoryResource
Tell if a specified resource is a directory resource. Resources which end with the resource separator are directory resources.
- Parameters:
resourceName
- The resource name to test.- Returns:
- True if the resource is a directory resource. Otherwise, false.
-
isClassResource
Tell if a specified resource is a class resource. A resource is a class resource if and only if it has the class extension.
- Parameters:
resourceName
- The resource which is to be tested.- Returns:
- True if the resource is a class resource. Otherwise, false.
-
getClassNameFromResourceName
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.
- Parameters:
resourceName
- The resource to convert to a class name.- Returns:
- The class name for the resource.
-
getResourceNameFromClassName
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.
- Parameters:
className
- The class name to convert to a resource.- Returns:
- The resource for the class name.
-
inconvertResourceName
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.
- Parameters:
externalResourceName
- The external form of the resource.- Returns:
- The internal form of the resource.
-
outconvertResourceName
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.
- Parameters:
internalResourceName
- The internal form of the resource.- Returns:
- The external form of the resource.
-
openClassStream
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.
- Parameters:
className
- The name of the class for which to open an input stream.- Returns:
- The input stream for the named class. Null if no resource is available for the class.
- Throws:
ClassSource_Exception
- Thrown in case a resource is available for the class, but that resource could not be opened.
-
openResourceStream
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.
- Parameters:
className
- The name of the class for which to open an input stream.resourceName
- The name of the resource of the class.- Returns:
- The input stream for the named class. Null if no resource is available for the class.
- Throws:
ClassSource_Exception
- Thrown in case a resource is available for the class, but that resource could not be opened.
-
closeClassStream
Class the input stream which was opened for a specified class.
- Parameters:
className
- The class for which the input stream was opened.inputStream
- The input stream which is to be closed.- Throws:
ClassSource_Exception
- Thrown in case the input stream could not be closed.
-
closeResourceStream
void closeResourceStream(String className, String resourceName, 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.
- Parameters:
className
- The class for which the input stream was opened.resourceName
- The name of the resource of the class.inputStream
- The input stream which is to be closed.- Throws:
ClassSource_Exception
- Thrown in case the input stream could not be closed.
-
getResourceExclusionCount
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.
- Returns:
- The count of resources excluded from processing as non-class resources.
isClassResource(String)
-
getClassExclusionCount
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.
- Returns:
- The count of class resources for duplicate classes.
getClassInclusionCount()
isClassResource(String)
ClassSource_Streamer.doProcess(java.lang.String, com.ibm.wsspi.anno.classsource.ClassSource_Aggregate.ScanPolicy)
-
getClassInclusionCount
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.
- Returns:
- The count of class resources for distinct classes.
getClassExclusionCount()
isClassResource(String)
ClassSource_Streamer.doProcess(java.lang.String, com.ibm.wsspi.anno.classsource.ClassSource_Aggregate.ScanPolicy)
-
isProcessedUsingJandex
boolean isProcessedUsingJandex()
-