public 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.
Modifier and Type | Interface and Description |
---|---|
static class |
AnnotationTargets_Targets.AnnotationCategory
Enumeration used for the several categories of annotations.
|
Modifier and Type | Field and Description |
---|---|
static int |
POLICY_ALL_EXCEPT_EXTERNAL
Synonym for
ClassSource_Aggregate.ScanPolicy.ALL_EXCEPT_EXTERNAL . |
static int |
POLICY_EXCLUDED
Synonym for the value of
ClassSource_Aggregate.ScanPolicy.EXCLUDED . |
static int |
POLICY_EXTERNAL
Synonym for the value of
ClassSource_Aggregate.ScanPolicy.EXTERNAL . |
static int |
POLICY_PARTIAL
Synonym for the value of
ClassSource_Aggregate.ScanPolicy.PARTIAL . |
static int |
POLICY_SEED
Synonym for the value of
ClassSource_Aggregate.ScanPolicy.SEED . |
static int |
POLICY_SEED_AND_PARTIAL
Synonym for
ClassSource_Aggregate.ScanPolicy.SEED OR'ed with
ClassSource_Aggregate.ScanPolicy.PARTIAL . |
Modifier and Type | Method and Description |
---|---|
void |
addClassSource(ClassSource classSource,
ClassSource_Aggregate.ScanPolicy scanPolicy)
Add a class source to the aggregate class source held by this
targets table.
|
java.util.Set<java.lang.String> |
getAllImplementorsOf(java.lang.String interfaceName)
Answer the names of all the implementors of a target interface.
|
java.util.Set<java.lang.String> |
getAllInheritedAnnotatedClasses(java.lang.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.
|
java.util.Set<java.lang.String> |
getAllInheritedAnnotatedClasses(java.lang.String annotationName,
int scanPolicies)
Utility for inherited class annotations.
|
java.util.Set<java.lang.String> |
getAllInheritedAnnotatedClasses(java.lang.String annotationName,
int declarerScanPolicies,
int inheritorScanPolicies)
Utility for inherited class annotations.
|
java.util.Set<java.lang.String> |
getAnnotatedClasses()
Answer the names of classes having class annotations.
|
java.util.Set<java.lang.String> |
getAnnotatedClasses(int scanPolicies)
Answer the names of classes having class annotations.
|
java.util.Set<java.lang.String> |
getAnnotatedClasses(java.lang.String annotationName)
Answer the names of classes having the specified annotation.
|
java.util.Set<java.lang.String> |
getAnnotatedClasses(java.lang.String annotationName,
int scanPolicies)
Answer the names of classes having the specified annotation.
|
java.util.Set<java.lang.String> |
getAnnotatedClasses(java.lang.String classSourceName,
java.lang.String annotationName)
Answer the names of the classes having the specified class annotation.
|
java.util.Set<java.lang.String> |
getAnnotatedClasses(java.lang.String classSourceName,
java.lang.String annotationName,
int scanPolicies)
Answer the names of the classes having the specified class annotation.
|
java.util.Set<java.lang.String> |
getAnnotatedPackages()
Answer the names of packages having annotations.
|
java.util.Set<java.lang.String> |
getAnnotatedPackages(int scanPolicies)
Answer the names of packages having annotations.
|
java.util.Set<java.lang.String> |
getAnnotatedPackages(java.lang.String annotationName)
Answer the names of packages having the specified annotation.
|
java.util.Set<java.lang.String> |
getAnnotatedPackages(java.lang.String annotationName,
int scanPolicies)
Answer the names of packages having the specified annotation.
|
java.util.Set<java.lang.String> |
getClassAnnotations()
Answer all recorded SEED class annotations.
|
java.util.Set<java.lang.String> |
getClassAnnotations(int scanPolicies)
Answer the names of recorded class annotations.
|
java.util.Set<java.lang.String> |
getClassAnnotations(java.lang.String className)
Answer the class annotations of a specified class.
|
java.util.Set<java.lang.String> |
getClassAnnotations(java.lang.String className,
int scanPolicies)
Answer the names of annotations on the specified class.
|
java.util.Set<java.lang.String> |
getClassesWithFieldAnnotation(java.lang.String annotationName)
Answer the names of the classes having any declared occurrence of
the specified field annotation.
|
java.util.Set<java.lang.String> |
getClassesWithFieldAnnotation(java.lang.String annotationName,
int scanPolicies)
Answer the names of the classes having any declared occurrence of
the specified field annotation.
|
java.util.Set<java.lang.String> |
getClassesWithFieldAnnotations(int scanPolicies)
Answer the names of the classes having any declared occurrence of
a field annotation.
|
java.util.Set<java.lang.String> |
getClassesWithMethodAnnotation(java.lang.String annotationName)
Answer the names of the classes having any declared occurrence of
the specified method annotation.
|
java.util.Set<java.lang.String> |
getClassesWithMethodAnnotation(java.lang.String annotationName,
int scanPolicies)
Answer the names of the classes having any declared occurrence of
the specified method annotation.
|
java.util.Set<java.lang.String> |
getClassesWithMethodAnnotations(int scanPolicies)
Answer the names of the classes having any method annotations.
|
java.util.Set<java.lang.String> |
getClassNames(int scanPolicies)
Answer the class names in the specified regions.
|
java.util.Set<java.lang.String> |
getExcludedClassNames()
Answer the excluded class names.
|
java.util.Set<java.lang.String> |
getExternalClassNames()
Answer the external class names.
|
AnnotationTargets_Factory |
getFactory()
Answer the factory which was used to create this targets table.
|
java.util.Set<java.lang.String> |
getFieldAnnotations()
Answer the names of recorded field annotations.
|
java.util.Set<java.lang.String> |
getFieldAnnotations(int scanPolicies)
Answer the names of recorded field annotations.
|
java.util.Set<java.lang.String> |
getFieldAnnotations(java.lang.String className)
Answer the names of the field annotations recorded on the specified class.
|
java.util.Set<java.lang.String> |
getFieldAnnotations(java.lang.String className,
int scanPolicies)
Answer the names of the field annotations recorded on the specified class.
|
boolean |
getIsDetailEnabled()
Tell if detail mode is enabled for the targets tables.
|
java.util.Set<java.lang.String> |
getMethodAnnotations()
Answer the names of the recorded annotations.
|
java.util.Set<java.lang.String> |
getMethodAnnotations(int scanPolicies)
Answer the names of the recorded method annotations.
|
java.util.Set<java.lang.String> |
getMethodAnnotations(java.lang.String className)
Answer the names of the method annotations recorded on the specified class.
|
java.util.Set<java.lang.String> |
getMethodAnnotations(java.lang.String className,
int scanPolicies)
Answer the names of the method annotations recorded on the specified class.
|
java.util.Set<java.lang.String> |
getPackageAnnotations()
Answer all recorded SEED package annotations.
|
java.util.Set<java.lang.String> |
getPackageAnnotations(int scanPolicies)
Answer the names of recorded package annotations.
|
java.util.Set<java.lang.String> |
getPackageAnnotations(java.lang.String packageName)
Answer the annotations of a specified package.
|
java.util.Set<java.lang.String> |
getPackageAnnotations(java.lang.String packageName,
int scanPolicies)
Answer the names of annotations on the specified package.
|
java.util.Set<java.lang.String> |
getPartialClassNames()
Answer the partial class names.
|
java.util.Set<java.lang.String> |
getSeedClassNames()
Answer the seed class names.
|
java.util.Set<java.lang.String> |
getSubclassNames(java.lang.String className)
Answer the name of all of the subclasses of a target class.
|
java.lang.String |
getSuperclassName(java.lang.String className)
Answer the name of the super class of a target class.
|
boolean |
isExcludedClassName(java.lang.String className)
Tell if a particular named class is an excluded class.
|
boolean |
isExternalClassName(java.lang.String className)
Tell if a particular named class is an external class.
|
boolean |
isInstanceOf(java.lang.String candidateClassName,
java.lang.Class<?> criterionClass)
Tell if a candidate class is an instance of a specified class.
|
boolean |
isPartialClassName(java.lang.String className)
Tell if a particular named class is a partial class.
|
boolean |
isSeedClassName(java.lang.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,
java.util.Set<java.lang.String> specificClassNames)
Perform a scan of the specified class source, injecting scan data
into the annotation targets.
|
static final int POLICY_ALL_EXCEPT_EXTERNAL
Synonym for ClassSource_Aggregate.ScanPolicy.ALL_EXCEPT_EXTERNAL
.
static final int POLICY_SEED_AND_PARTIAL
Synonym for ClassSource_Aggregate.ScanPolicy.SEED
OR'ed with
ClassSource_Aggregate.ScanPolicy.PARTIAL
.
static final int POLICY_SEED
Synonym for the value of ClassSource_Aggregate.ScanPolicy.SEED
.
static final int POLICY_PARTIAL
Synonym for the value of ClassSource_Aggregate.ScanPolicy.PARTIAL
.
static final int POLICY_EXCLUDED
Synonym for the value of ClassSource_Aggregate.ScanPolicy.EXCLUDED
.
static final int POLICY_EXTERNAL
Synonym for the value of ClassSource_Aggregate.ScanPolicy.EXTERNAL
.
AnnotationTargets_Factory getFactory()
Answer the factory which was used to create this targets table. Objects created from this targets table use this factory.
void addClassSource(ClassSource classSource, ClassSource_Aggregate.ScanPolicy scanPolicy)
Add a class source to the aggregate class source held by this targets table.
classSource
- The class source to add to this targets table.scanPolicy
- The policy to set for the class source.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.
void scan(ClassSource_Aggregate classSource) throws AnnotationTargets_Exception
Perform a scan of the specified class source, injecting scan data into the annotation targets.
classSource
- The class source which is to be scanned.AnnotationTargets_Exception
- Thrown if an error occurred during scanning.void scan(ClassSource_Aggregate classSource, java.util.Set<java.lang.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.
classSource
- The class source which is to be scanned.specificClassNames
- The names of the specific classes which are to be scanned.AnnotationTargets_Exception
- Thrown if an error occurred during scanning.void scan(ClassSource_Aggregate classSource, boolean greedy) throws AnnotationTargets_Exception
classSource
- greedy
- AnnotationTargets_Exception
boolean isSeedClassName(java.lang.String className)
Tell if a particular named class is a seed class name.
className
- The class name to test.getSeedClassNames()
java.util.Set<java.lang.String> getSeedClassNames()
Answer the seed class names.
boolean isPartialClassName(java.lang.String className)
Tell if a particular named class is a partial class.
className
- The class name to test.getPartialClassNames()
java.util.Set<java.lang.String> getPartialClassNames()
Answer the partial class names.
boolean isExcludedClassName(java.lang.String className)
Tell if a particular named class is an excluded class.
className
- The class name to test.getExcludedClassNames()
java.util.Set<java.lang.String> getExcludedClassNames()
Answer the excluded class names.
boolean isExternalClassName(java.lang.String className)
Tell if a particular named class is an external class.
className
- The class name to test.getExternalClassNames()
java.util.Set<java.lang.String> getExternalClassNames()
Answer the external class names.
boolean isInstanceOf(java.lang.String candidateClassName, java.lang.Class<?> criterionClass)
Tell if a candidate class is an instance of a specified class.
candidateClassName
- The name of the class to test.criterionClass
- The class to test against.java.lang.String getSuperclassName(java.lang.String className)
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.
className
- The name of the target class.java.util.Set<java.lang.String> getSubclassNames(java.lang.String className)
Answer the name of all of the subclasses of a target class.
className
- The class for which to obtain subclass names.java.util.Set<java.lang.String> getAllImplementorsOf(java.lang.String interfaceName)
Answer the names of all the implementors of a target interface.
interfaceName
- The name of the target interface.java.util.Set<java.lang.String> getAnnotatedPackages()
Answer the names of packages having annotations. Limit results to SEED packages.
java.util.Set<java.lang.String> getAnnotatedPackages(java.lang.String annotationName)
Answer the names of packages having the specified annotation. Limit results to SEED packages.
annotationName
- The name of the annotation on which to select.java.util.Set<java.lang.String> getPackageAnnotations()
Answer all recorded SEED package annotations.
java.util.Set<java.lang.String> getPackageAnnotations(java.lang.String packageName)
Answer the annotations of a specified package. Select from SEED results.
packageName
- The name of the package for which to select annotations.java.util.Set<java.lang.String> getAnnotatedClasses()
Answer the names of classes having class annotations. Limit results to SEED classes.
java.util.Set<java.lang.String> getAnnotatedClasses(java.lang.String annotationName)
Answer the names of classes having the specified annotation. Limit results to SEED classes.
annotationName
- The name of the class annotation on which to select.java.util.Set<java.lang.String> getClassAnnotations()
Answer all recorded SEED class annotations.
java.util.Set<java.lang.String> getClassAnnotations(java.lang.String className)
Answer the class annotations of a specified class. Select from SEED results.
className
- The name of the class for which to select class annotations.java.util.Set<java.lang.String> getClassesWithFieldAnnotation(java.lang.String annotationName)
Answer the names of the classes having any declared occurrence of the specified field annotation. Select from within SEED results.
annotationName
- The name of the field annotation on which to select.java.util.Set<java.lang.String> getFieldAnnotations()
Answer the names of recorded field annotations. Select from within SEED results.
java.util.Set<java.lang.String> getFieldAnnotations(java.lang.String className)
Answer the names of the field annotations recorded on the specified class. Select from within SEED results.
className
- The name of the class for which to select field annotations.java.util.Set<java.lang.String> getClassesWithMethodAnnotation(java.lang.String annotationName)
Answer the names of the classes having any declared occurrence of the specified method annotation. Select from within SEED results.
annotationName
- The name of the method annotation on which to select.java.util.Set<java.lang.String> getMethodAnnotations()
Answer the names of the recorded annotations. Select from within SEED results.
java.util.Set<java.lang.String> getMethodAnnotations(java.lang.String className)
Answer the names of the method annotations recorded on the specified class. Select from within SEED results.
className
- The name of the class for which to select method annotations.java.util.Set<java.lang.String> getAnnotatedClasses(java.lang.String classSourceName, java.lang.String annotationName)
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.
classSourceName
- The name of the class source used to restrict the results.annotationName
- The name of the class annotation on which to select.java.util.Set<java.lang.String> getAnnotatedClasses(java.lang.String classSourceName, java.lang.String annotationName, int scanPolicies)
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.
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.java.util.Set<java.lang.String> getClassNames(int scanPolicies)
Answer the class names in the specified regions.
scanPolicies
- The scan policies for which to select class names.java.util.Set<java.lang.String> getAnnotatedPackages(int scanPolicies)
Answer the names of packages having annotations. Limit results to the specified regions.
scanPolicies
- The policies for which to select annotated packages, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getAnnotatedPackages(java.lang.String annotationName, int scanPolicies)
Answer the names of packages having the specified annotation. Limit results to the specified regions.
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.java.util.Set<java.lang.String> getPackageAnnotations(int scanPolicies)
Answer the names of recorded package annotations. Restrict results to only those recorded in the specified regions.
scanPolicies
- The policies for which to select package annotations, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getPackageAnnotations(java.lang.String packageName, int scanPolicies)
Answer the names of annotations on the specified package. Restrict results to only those recorded in the specified regions.
className
- 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.java.util.Set<java.lang.String> getAnnotatedClasses(int scanPolicies)
Answer the names of classes having class annotations. Limit results to the specified regions.
scanPolicies
- The policies for which to select annotated classes, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getAnnotatedClasses(java.lang.String annotationName, int scanPolicies)
Answer the names of classes having the specified annotation. Limit results to the specified regions.
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.java.util.Set<java.lang.String> getClassAnnotations(int scanPolicies)
Answer the names of recorded class annotations. Restrict results to only those recorded in the specified regions.
scanPolicies
- The policies for which to select class annotations, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getClassAnnotations(java.lang.String className, int scanPolicies)
Answer the names of annotations on the specified class. Restrict results to only those recorded in the specified regions.
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.java.util.Set<java.lang.String> getClassesWithFieldAnnotations(int scanPolicies)
Answer the names of the classes having any declared occurrence of a field annotation. Select from within the specified results.
scanPolicies
- The policies for which to select class annotations, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getClassesWithFieldAnnotation(java.lang.String annotationName, int scanPolicies)
Answer the names of the classes having any declared occurrence of the specified field annotation. Select from within the specified results.
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.java.util.Set<java.lang.String> getFieldAnnotations(int scanPolicies)
Answer the names of recorded field annotations. Select from within the specified results.
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.java.util.Set<java.lang.String> getFieldAnnotations(java.lang.String className, int scanPolicies)
Answer the names of the field annotations recorded on the specified class. Select from within the specified results.
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.java.util.Set<java.lang.String> getClassesWithMethodAnnotations(int scanPolicies)
Answer the names of the classes having any method annotations. Select Select from within the specified results.
scanPolicies
- The policies for which to select class annotations, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getClassesWithMethodAnnotation(java.lang.String annotationName, int scanPolicies)
Answer the names of the classes having any declared occurrence of the specified method annotation. Select from within the specified results.
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.java.util.Set<java.lang.String> getMethodAnnotations(int scanPolicies)
Answer the names of the recorded method annotations. Select from within the specified results.
scanPolicies
- The policies for which to select class annotations, as bitwise
OR of scan policy values.java.util.Set<java.lang.String> getMethodAnnotations(java.lang.String className, int scanPolicies)
Answer the names of the method annotations recorded on the specified class. Select from within the specified results.
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.java.util.Set<java.lang.String> getAllInheritedAnnotatedClasses(java.lang.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.
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 #selectAnnotatedClasses()
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.
annotationName
- The class annotation for which to obtain annotations.java.util.Set<java.lang.String> getAllInheritedAnnotatedClasses(java.lang.String annotationName, int scanPolicies)
Utility for inherited class annotations. Similar to selectAllInheritedAnnotatedClasses(String)
,
except that the results are restricted to annotations declared in the specified
results and inherited by classes in the specified results.
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.java.util.Set<java.lang.String> getAllInheritedAnnotatedClasses(java.lang.String annotationName, int declarerScanPolicies, int inheritorScanPolicies)
Utility for inherited class annotations. Similar to selectAllInheritedAnnotatedClasses(String)
,
except that the results are restricted to annotations declared the specified
results and inherited by classes in distinct specified results.
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.