Interface AnnotationTargets_Targets
Annotation targets tables. Results include package source information, class source information, class relationship information and annotation targets information.
Package source information consists of a listing of packages partitioned by the class source which provided each package.
Class source information consists of a listing of classes partitioned by the class source which provided each class.
Class relationship information consists of class to interface relationships and class to superclass relationships.
Annotation information consists of the recording of package, class, field, and method annotation occurrences. Results are stored as mappings of package and class names to annotation names. Detail values for the annotation occurrences are not recorded. The particular target field or methods of the occurrences are not recorded.
Results are partitioned by scan policy (see ClassSource_Aggregate.ScanPolicy
),
respectively, SEED, PARTIAL, EXCLUDED, and EXTERNAL. For non-web module cases, only SEED and
EXTERNAL apply. Web module cases use PARTIAL and EXCLUDED for particular cases involving
metadata-complete fragment jars and for particular cases involving web module jars which
were excluded by their omittion from an absolute ordering specified for the web module.
Classes are recorded for SEED, PARTIAL, and EXCLUDED regions. Classes are recorded for EXTERNAL regions only as needed to complete class relationship information.
Annotations occurrences are recorded for SEED, PARTIAL, and EXCLUDED regions. Annotation occurrences are omitted from EXTERNAL regions.
Annotation selection queries default to select SEED results, unless an explicit selection policy is specified. When specified, the selection policy is the bitwise OR of scan policy values. Results are selected from all regions which are included in specified policy.
Helpers are available for selecting classes which are the target of inherited class annotations. Particular care must be used when selecting such classes. The helpers may be used for non-inheritable class annotations, but will obtain meaningless results. Using the helpers, usually, the regions used to select the classes declaring annotations is the same as the region used to select the inheriting classes. However, the helpers allow these regions to be different.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Enumeration used for the several categories of annotations. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Synonym forClassSource_Aggregate.ScanPolicy.ALL_EXCEPT_EXTERNAL
.static final int
Synonym for the value ofClassSource_Aggregate.ScanPolicy.EXCLUDED
.static final int
Synonym for the value ofClassSource_Aggregate.ScanPolicy.EXTERNAL
.static final int
Synonym for the value ofClassSource_Aggregate.ScanPolicy.PARTIAL
.static final int
Synonym for the value ofClassSource_Aggregate.ScanPolicy.SEED
.static final int
Synonym forClassSource_Aggregate.ScanPolicy.SEED
OR'ed withClassSource_Aggregate.ScanPolicy.PARTIAL
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassSource
(ClassSource classSource, ClassSource_Aggregate.ScanPolicy scanPolicy) Add a class source to the aggregate class source held by this targets table.getAllImplementorsOf
(String interfaceName) Answer the names of all the implementors of a target interface.getAllInheritedAnnotatedClasses
(String annotationName) Utility for inherited class annotations: Find classes which have the specified class annotation, or which are a subclass of a class which has the specified class annotation.getAllInheritedAnnotatedClasses
(String annotationName, int scanPolicies) Utility for inherited class annotations.getAllInheritedAnnotatedClasses
(String annotationName, int declarerScanPolicies, int inheritorScanPolicies) Utility for inherited class annotations.Answer the names of classes having class annotations.getAnnotatedClasses
(int scanPolicies) Answer the names of classes having class annotations.getAnnotatedClasses
(String annotationName) Answer the names of classes having the specified annotation.getAnnotatedClasses
(String annotationName, int scanPolicies) Answer the names of classes having the specified annotation.getAnnotatedClasses
(String classSourceName, String annotationName) Answer the names of the classes having the specified class annotation.getAnnotatedClasses
(String classSourceName, String annotationName, int scanPolicies) Answer the names of the classes having the specified class annotation.Answer the names of packages having annotations.getAnnotatedPackages
(int scanPolicies) Answer the names of packages having annotations.getAnnotatedPackages
(String annotationName) Answer the names of packages having the specified annotation.getAnnotatedPackages
(String annotationName, int scanPolicies) Answer the names of packages having the specified annotation.Answer all recorded SEED class annotations.getClassAnnotations
(int scanPolicies) Answer the names of recorded class annotations.getClassAnnotations
(String className) Answer the class annotations of a specified class.getClassAnnotations
(String className, int scanPolicies) Answer the names of annotations on the specified class.getClassesWithFieldAnnotation
(String annotationName) Answer the names of the classes having any declared occurrence of the specified field annotation.getClassesWithFieldAnnotation
(String annotationName, int scanPolicies) Answer the names of the classes having any declared occurrence of the specified field annotation.getClassesWithFieldAnnotations
(int scanPolicies) Answer the names of the classes having any declared occurrence of a field annotation.getClassesWithMethodAnnotation
(String annotationName) Answer the names of the classes having any declared occurrence of the specified method annotation.getClassesWithMethodAnnotation
(String annotationName, int scanPolicies) Answer the names of the classes having any declared occurrence of the specified method annotation.getClassesWithMethodAnnotations
(int scanPolicies) Answer the names of the classes having any method annotations.getClassNames
(int scanPolicies) Answer the class names in the specified regions.Answer the excluded class names.Answer the external class names.Answer the factory which was used to create this targets table.Answer the names of recorded field annotations.getFieldAnnotations
(int scanPolicies) Answer the names of recorded field annotations.getFieldAnnotations
(String className) Answer the names of the field annotations recorded on the specified class.getFieldAnnotations
(String className, int scanPolicies) Answer the names of the field annotations recorded on the specified class.boolean
Tell if detail mode is enabled for the targets tables.Answer the names of the recorded annotations.getMethodAnnotations
(int scanPolicies) Answer the names of the recorded method annotations.getMethodAnnotations
(String className) Answer the names of the method annotations recorded on the specified class.getMethodAnnotations
(String className, int scanPolicies) Answer the names of the method annotations recorded on the specified class.Answer all recorded SEED package annotations.getPackageAnnotations
(int scanPolicies) Answer the names of recorded package annotations.getPackageAnnotations
(String packageName) Answer the annotations of a specified package.getPackageAnnotations
(String packageName, int scanPolicies) Answer the names of annotations on the specified package.Answer the partial class names.Answer the seed class names.getSubclassNames
(String className) Answer the name of all of the subclasses of a target class.getSuperclassName
(String className) Answer the name of the super class of a target class.boolean
isExcludedClassName
(String className) Tell if a particular named class is an excluded class.boolean
isExternalClassName
(String className) Tell if a particular named class is an external class.boolean
isInstanceOf
(String candidateClassName, Class<?> criterionClass) Tell if a candidate class is an instance of a specified class.boolean
isPartialClassName
(String className) Tell if a particular named class is a partial class.boolean
isSeedClassName
(String className) Tell if a particular named class is a seed class name.void
scan
(ClassSource_Aggregate classSource) Perform a scan of the specified class source, injecting scan data into the annotation targets.void
scan
(ClassSource_Aggregate classSource, boolean greedy) void
scan
(ClassSource_Aggregate classSource, Set<String> specificClassNames) Perform a scan of the specified class source, injecting scan data into the annotation targets.
-
Field Details
-
POLICY_ALL_EXCEPT_EXTERNAL
static final int POLICY_ALL_EXCEPT_EXTERNALSynonym for
ClassSource_Aggregate.ScanPolicy.ALL_EXCEPT_EXTERNAL
. -
POLICY_SEED_AND_PARTIAL
static final int POLICY_SEED_AND_PARTIALSynonym for
ClassSource_Aggregate.ScanPolicy.SEED
OR'ed withClassSource_Aggregate.ScanPolicy.PARTIAL
. -
POLICY_SEED
static final int POLICY_SEEDSynonym for the value of
ClassSource_Aggregate.ScanPolicy.SEED
. -
POLICY_PARTIAL
static final int POLICY_PARTIALSynonym for the value of
ClassSource_Aggregate.ScanPolicy.PARTIAL
. -
POLICY_EXCLUDED
static final int POLICY_EXCLUDEDSynonym for the value of
ClassSource_Aggregate.ScanPolicy.EXCLUDED
. -
POLICY_EXTERNAL
static final int POLICY_EXTERNALSynonym for the value of
ClassSource_Aggregate.ScanPolicy.EXTERNAL
.
-
-
Method Details
-
getFactory
AnnotationTargets_Factory getFactory()Answer the factory which was used to create this targets table. Objects created from this targets table use this factory.
- Returns:
- The factory used to create this targets table.
-
addClassSource
Add a class source to the aggregate class source held by this targets table.
- Parameters:
classSource
- The class source to add to this targets table.scanPolicy
- The policy to set for the class source.
-
getIsDetailEnabled
boolean getIsDetailEnabled()Tell if detail mode is enabled for the targets tables. Field and method annotations are recorded only when detail mode is enabled.
At this time, detail mode is always enabled. A capability to enable/disable field and method annotation recording is provided as a future enhancement. A small performance gain is achieved by disabling field and method annotation recording. A small to large space savings is achieved by disabling field and method annotations, depending on the relative quantity of field and method annotations in the target scan space.
- Returns:
- True if detail mode is enabled. Otherwise, false.
-
scan
Perform a scan of the specified class source, injecting scan data into the annotation targets.
- Parameters:
classSource
- The class source which is to be scanned.- Throws:
AnnotationTargets_Exception
- Thrown if an error occurred during scanning.
-
scan
void scan(ClassSource_Aggregate classSource, Set<String> specificClassNames) throws AnnotationTargets_Exception Perform a scan of the specified class source, injecting scan data into the annotation targets. Scan only the specified classes.
- Parameters:
classSource
- The class source which is to be scanned.specificClassNames
- The names of the specific classes which are to be scanned.- Throws:
AnnotationTargets_Exception
- Thrown if an error occurred during scanning.
-
scan
- Throws:
AnnotationTargets_Exception
-
isSeedClassName
Tell if a particular named class is a seed class name.
- Parameters:
className
- The class name to test.- Returns:
- True if the named class was scanned as a seed class. Otherwise, false.
getSeedClassNames()
-
getSeedClassNames
Answer the seed class names.
- Returns:
- The seed class names.
-
isPartialClassName
Tell if a particular named class is a partial class.
- Parameters:
className
- The class name to test.- Returns:
- True if the named class is a partial class. Otherwise, false.
getPartialClassNames()
-
getPartialClassNames
Answer the partial class names.
- Returns:
- The partial class names.
-
isExcludedClassName
Tell if a particular named class is an excluded class.
- Parameters:
className
- The class name to test.- Returns:
- True if the named class is an excluded class. Otherwise, false.
getExcludedClassNames()
-
getExcludedClassNames
Answer the excluded class names.
- Returns:
- The seed class names.
-
isExternalClassName
Tell if a particular named class is an external class.
- Parameters:
className
- The class name to test.- Returns:
- True if the named class is an external class. Otherwise, false.
getExternalClassNames()
-
getExternalClassNames
Answer the external class names.
- Returns:
- The external class names.
-
isInstanceOf
Tell if a candidate class is an instance of a specified class.
- Parameters:
candidateClassName
- The name of the class to test.criterionClass
- The class to test against.- Returns:
- True if the candidate class is an instance of the criterion class. Otherwise, false.
-
getSuperclassName
Answer the name of the super class of a target class. Answer null if the target class is java.lang.Object, or is an interface.
- Parameters:
className
- The name of the target class.- Returns:
- The name of the superclass of the target class.
-
getSubclassNames
Answer the name of all of the subclasses of a target class.
- Parameters:
className
- The class for which to obtain subclass names.- Returns:
- The names of all subclasses of the target class.
-
getAllImplementorsOf
Answer the names of all the implementors of a target interface.
- Parameters:
interfaceName
- The name of the target interface.- Returns:
- The names of all implementers of the target interface.
-
getAnnotatedPackages
Answer the names of packages having annotations. Limit results to SEED packages.
- Returns:
- The names of the packages having annotations.
-
getAnnotatedPackages
Answer the names of packages having the specified annotation. Limit results to SEED packages.
- Parameters:
annotationName
- The name of the annotation on which to select.- Returns:
- The names of the packages having the specified annotation.
-
getPackageAnnotations
Answer all recorded SEED package annotations.
- Returns:
- The names of all recorded SEED package annotations.
-
getPackageAnnotations
Answer the annotations of a specified package. Select from SEED results.
- Parameters:
packageName
- The name of the package for which to select annotations.- Returns:
- The names of annotations of the named package, selected from SEED results.
-
getAnnotatedClasses
Answer the names of classes having class annotations. Limit results to SEED classes.
- Returns:
- The names of the classes having class annotations.
-
getAnnotatedClasses
Answer the names of classes having the specified annotation. Limit results to SEED classes.
- Parameters:
annotationName
- The name of the class annotation on which to select.- Returns:
- The names of the classes having the specified class annotation.
-
getClassAnnotations
Answer all recorded SEED class annotations.
- Returns:
- The names of all recorded SEED class annotations.
-
getClassAnnotations
Answer the class annotations of a specified class. Select from SEED results.
- Parameters:
className
- The name of the class for which to select class annotations.- Returns:
- The names of class annotations of the named class, selected from SEED results.
-
getClassesWithFieldAnnotation
Answer the names of the classes having any declared occurrence of the specified field annotation. Select from within SEED results.
- Parameters:
annotationName
- The name of the field annotation on which to select.- Returns:
- The names of the classes having the specified field annotation.
-
getFieldAnnotations
Answer the names of recorded field annotations. Select from within SEED results.
- Returns:
- The names of field annotations of the named class, selected from SEED results.
-
getFieldAnnotations
Answer the names of the field annotations recorded on the specified class. Select from within SEED results.
- Parameters:
className
- The name of the class for which to select field annotations.- Returns:
- The names of field annotations of the named class, selected from SEED results.
-
getClassesWithMethodAnnotation
Answer the names of the classes having any declared occurrence of the specified method annotation. Select from within SEED results.
- Parameters:
annotationName
- The name of the method annotation on which to select.- Returns:
- The names of the classes having the specified method annotation.
-
getMethodAnnotations
Answer the names of the recorded annotations. Select from within SEED results.
- Returns:
- The names of method annotations, selected from SEED results.
-
getMethodAnnotations
Answer the names of the method annotations recorded on the specified class. Select from within SEED results.
- Parameters:
className
- The name of the class for which to select method annotations.- Returns:
- The names of method annotations of the named class, selected from SEED results.
-
getAnnotatedClasses
Answer the names of the classes having the specified class annotation. Limit the results to classes within the specified class source and to SEED results.
- Parameters:
classSourceName
- The name of the class source used to restrict the results.annotationName
- The name of the class annotation on which to select.- Returns:
- The names of the classes having the specified class annotation.
-
getAnnotatedClasses
Answer the names of the classes having the specified class annotation. Limit the results to classes within the specified class source and to the specified results.
- Parameters:
classSourceName
- The name of the class source used to restrict the results.annotationName
- The name of the class annotation on which to select.scanPolicies
- The policies for which to select annotated classes, as bitwise OR of scan policy values.- Returns:
- The names of the classes having the specified class annotation.
-
getClassNames
Answer the class names in the specified regions.
- Parameters:
scanPolicies
- The scan policies for which to select class names.- Returns:
- The names of all classes in the specified regions.
-
getAnnotatedPackages
Answer the names of packages having annotations. Limit results to the specified regions.
- Parameters:
scanPolicies
- The policies for which to select annotated packages, as bitwise OR of scan policy values.- Returns:
- The names of the packages having annotations.
-
getAnnotatedPackages
Answer the names of packages having the specified annotation. Limit results to the specified regions.
- Parameters:
annotationName
- The name of the package annotation on which to select.scanPolicies
- The policies for which to select annotated packages, as bitwise OR of scan policy values.- Returns:
- The names of the packages having the specified annotation.
-
getPackageAnnotations
Answer the names of recorded package annotations. Restrict results to only those recorded in the specified regions.
- Parameters:
scanPolicies
- The policies for which to select package annotations, as bitwise OR of scan policy values.- Returns:
- The names of recorded package annotations selected from the specified results.
-
getPackageAnnotations
Answer the names of annotations on the specified package. Restrict results to only those recorded in the specified regions.
- Parameters:
packageName
- The name of the package for which to select annotations.scanPolicies
- The policies for which to select package annotations, as bitwise OR of scan policy values.- Returns:
- The names of annotations of the named package, selected from the specified results.
-
getAnnotatedClasses
Answer the names of classes having class annotations. Limit results to the specified regions.
- Parameters:
scanPolicies
- The policies for which to select annotated classes, as bitwise OR of scan policy values.- Returns:
- The names of the classes having class annotations.
-
getAnnotatedClasses
Answer the names of classes having the specified annotation. Limit results to the specified regions.
- Parameters:
annotationName
- The name of the class annotation on which to select.scanPolicies
- The policies for which to select annotated classes, as bitwise OR of scan policy values.- Returns:
- The names of the classes having the specified class annotation.
-
getClassAnnotations
Answer the names of recorded class annotations. Restrict results to only those recorded in the specified regions.
- Parameters:
scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of recorded class annotations selected from the specified results.
-
getClassAnnotations
Answer the names of annotations on the specified class. Restrict results to only those recorded in the specified regions.
- Parameters:
className
- The name of the class for which to select class annotations.scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of class annotations of the named class, selected from the specified results.
-
getClassesWithFieldAnnotations
Answer the names of the classes having any declared occurrence of a field annotation. Select from within the specified results.
- Parameters:
scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of the classes having a field annotation.
-
getClassesWithFieldAnnotation
Answer the names of the classes having any declared occurrence of the specified field annotation. Select from within the specified results.
- Parameters:
annotationName
- The name of the field annotation on which to select.scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of the classes having the specified field annotation.
-
getFieldAnnotations
Answer the names of recorded field annotations. Select from within the specified results.
- Parameters:
scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of field annotations of the named class, selected from the specified results.
-
getFieldAnnotations
Answer the names of the field annotations recorded on the specified class. Select from within the specified results.
- Parameters:
className
- The name of the class for which to select field annotations.scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of field annotations of the named class, selected from the specified results.
-
getClassesWithMethodAnnotations
Answer the names of the classes having any method annotations. Select Select from within the specified results.
- Parameters:
scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of the classes having the specified method annotation.
-
getClassesWithMethodAnnotation
Answer the names of the classes having any declared occurrence of the specified method annotation. Select from within the specified results.
- Parameters:
annotationName
- The name of the method annotation on which to select.scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of the classes having the specified method annotation.
-
getMethodAnnotations
Answer the names of the recorded method annotations. Select from within the specified results.
- Parameters:
scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of method annotations of the named class, selected from the specified results.
-
getMethodAnnotations
Answer the names of the method annotations recorded on the specified class. Select from within the specified results.
- Parameters:
className
- The name of the class for which to select method annotations.scanPolicies
- The policies for which to select class annotations, as bitwise OR of scan policy values.- Returns:
- The names of method annotations of the named class, selected from the specified results.
-
getAllInheritedAnnotatedClasses
Utility for inherited class annotations: Find classes which have the specified class annotation, or which are a subclass of a class which has the specified class annotation.
Restrict the result to annotations specified in SEED classes and inherited by SEED classes. (Inheritance information may traverse non SEED classes.)
Do NOT use this method if the specified annotation type is not an inherited class annotation, as it is inefficient for that purpose. Use
getAnnotatedClasses(String)
instead.The operation does not require that the specified annotation type be an inherited class annotation. The result, however, is meaningless if the class annotation is not actually inherited.
No similar capability is provided for method annotations. Method annotations are not inheritable. For the related handling of annotations on inherited methods, more comprehensive processing must be performed, as method overloading must be taken into account. Use java reflection or the class info store to process annotations on inherited methods.
- Parameters:
annotationName
- The class annotation for which to obtain annotations.- Returns:
- All targets of a specified class annotation, including both declared and inheriting targets
-
getAllInheritedAnnotatedClasses
Utility for inherited class annotations. Similar to
getAllInheritedAnnotatedClasses(String)
, except that the results are restricted to annotations declared in the specified results and inherited by classes in the specified results.- Parameters:
annotationName
- The class annotation for which to obtain annotations.scanPolicies
- The policies for which to select classes, as bitwise OR of scan policy values. Applies to both declaring and inheriting classes considered for the results.- Returns:
- All targets of a specified class annotation, including both declared and inheriting targets, but limited by the selection policy.
-
getAllInheritedAnnotatedClasses
Set<String> getAllInheritedAnnotatedClasses(String annotationName, int declarerScanPolicies, int inheritorScanPolicies) Utility for inherited class annotations. Similar to
getAllInheritedAnnotatedClasses(String)
, except that the results are restricted to annotations declared the specified results and inherited by classes in distinct specified results.- Parameters:
annotationName
- The class annotation for which to obtain annotations.declarerScanPolicies
- The policies for which to select classes, as bitwise OR of scan policy values. Used to select classes which declare an occurrence of the specified annotation.inheritorScanPolicies
- The policies for which to select classes, as bitwise OR of scan policy values. Used to select classes which inherit from the selected annotated classes.- Returns:
- All targets of a specified class annotation, including both declared and inheriting targets, but limited by selection policies.
-