public class FeatureUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map<java.lang.reflect.AnnotatedElement,java.util.List<java.lang.annotation.Annotation>> |
annotationCache
A cache of annotated objects (typically a Class or Method) to its set of annotations.
|
private static java.util.Map<java.lang.Class<?>,TesterRequirements> |
classTesterRequirementsCache |
private static java.util.Map<java.lang.reflect.Method,TesterRequirements> |
methodTesterRequirementsCache |
| Constructor and Description |
|---|
FeatureUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Set<Feature<?>> |
addImpliedFeatures(java.util.Set<Feature<?>> features)
Given a set of features, add to it all the features directly or indirectly implied by any of
them, and return it.
|
static TesterRequirements |
buildDeclaredTesterRequirements(java.lang.reflect.AnnotatedElement classOrMethod)
Construct the set of requirements specified by annotations directly on a tester class or
method.
|
private static TesterRequirements |
buildTesterRequirements(java.lang.annotation.Annotation testerAnnotation)
Find all the constraints explicitly or implicitly specified by a single tester annotation.
|
(package private) static TesterRequirements |
buildTesterRequirements(java.lang.Class<?> testerClass)
Construct the full set of requirements for a tester class.
|
(package private) static TesterRequirements |
buildTesterRequirements(java.lang.reflect.Method testerMethod)
Construct the full set of requirements for a tester method.
|
private static void |
checkConflict(java.lang.String earlierRequirement,
java.util.Set<Feature<?>> earlierFeatures,
java.lang.String newRequirement,
java.util.Set<Feature<?>> newFeatures,
java.lang.Object source) |
static java.lang.Iterable<java.lang.annotation.Annotation> |
getTesterAnnotations(java.lang.reflect.AnnotatedElement classOrMethod)
Find all the tester annotations declared on a tester class or method.
|
static TesterRequirements |
getTesterRequirements(java.lang.Class<?> testerClass)
Get the full set of requirements for a tester class.
|
static TesterRequirements |
getTesterRequirements(java.lang.reflect.Method testerMethod)
Get the full set of requirements for a tester class.
|
static java.util.Set<Feature<?>> |
impliedFeatures(java.util.Set<Feature<?>> features)
Given a set of features, return a new set of all features directly or indirectly implied by any
of them.
|
private static TesterRequirements |
incorporateRequirements(TesterRequirements requirements,
TesterRequirements moreRequirements,
java.lang.Object source)
Incorporate additional requirements into an existing requirements object.
|
static <T> java.util.Set<T> |
intersection(java.util.Set<? extends T> set1,
java.util.Set<? extends T> set2)
Construct a new
Set that is the intersection of the given sets. |
private static java.util.Map<java.lang.reflect.AnnotatedElement,java.util.List<java.lang.annotation.Annotation>> annotationCache
private static final java.util.Map<java.lang.Class<?>,TesterRequirements> classTesterRequirementsCache
private static final java.util.Map<java.lang.reflect.Method,TesterRequirements> methodTesterRequirementsCache
public static java.util.Set<Feature<?>> addImpliedFeatures(java.util.Set<Feature<?>> features)
features - the set of features to expandpublic static java.util.Set<Feature<?>> impliedFeatures(java.util.Set<Feature<?>> features)
features - the set of features whose implications to findpublic static TesterRequirements getTesterRequirements(java.lang.Class<?> testerClass) throws ConflictingRequirementsException
testerClass - a tester classConflictingRequirementsException - if the requirements are mutually inconsistent.public static TesterRequirements getTesterRequirements(java.lang.reflect.Method testerMethod) throws ConflictingRequirementsException
testerMethod - a test method of a tester classConflictingRequirementsException - if the requirements are mutually inconsistent.static TesterRequirements buildTesterRequirements(java.lang.Class<?> testerClass) throws ConflictingRequirementsException
testerClass - a tester classConflictingRequirementsException - if the requirements are mutually inconsistent.static TesterRequirements buildTesterRequirements(java.lang.reflect.Method testerMethod) throws ConflictingRequirementsException
testerMethod - a test method of a tester classConflictingRequirementsException - if the requirements are mutually inconsistent.private static TesterRequirements buildTesterRequirements(java.lang.annotation.Annotation testerAnnotation) throws ConflictingRequirementsException
testerAnnotation - a tester annotationConflictingRequirementsException - if the requirements are mutually inconsistent.public static TesterRequirements buildDeclaredTesterRequirements(java.lang.reflect.AnnotatedElement classOrMethod) throws ConflictingRequirementsException
classOrMethod - a tester class or a test method thereofConflictingRequirementsException - if the requirements are mutually inconsistent.public static java.lang.Iterable<java.lang.annotation.Annotation> getTesterAnnotations(java.lang.reflect.AnnotatedElement classOrMethod)
classOrMethod - a class or method whose tester annotations to findprivate static TesterRequirements incorporateRequirements(TesterRequirements requirements, TesterRequirements moreRequirements, java.lang.Object source) throws ConflictingRequirementsException
requirements - the existing requirements objectmoreRequirements - more requirements to incorporatesource - the source of the additional requirements (used only for error reporting)ConflictingRequirementsException - if the additional requirements are inconsistent with
the existing requirementsprivate static void checkConflict(java.lang.String earlierRequirement,
java.util.Set<Feature<?>> earlierFeatures,
java.lang.String newRequirement,
java.util.Set<Feature<?>> newFeatures,
java.lang.Object source)
throws ConflictingRequirementsException
ConflictingRequirementsExceptionpublic static <T> java.util.Set<T> intersection(java.util.Set<? extends T> set1,
java.util.Set<? extends T> set2)
Set that is the intersection of the given sets.