Package org.reflections.util
Class ReflectionUtilsPredicates
java.lang.Object
org.reflections.util.ReflectionUtilsPredicates
- Direct Known Subclasses:
ReflectionUtils
helper predicates for java meta types
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Class<? extends Annotation>[]
annotationTypes
(Annotation[] annotations) private static Set
<Class<? extends Annotation>> annotationTypes
(Collection<Annotation> annotations) private static boolean
areAnnotationMembersMatching
(Annotation annotation1, Annotation annotation2) static boolean
isAssignable
(Class[] childClasses, Class[] parentClasses) private static Set
<Annotation> parameterAnnotations
(Member member) private static Class[]
parameterTypes
(Member member) private static String
static <T extends AnnotatedElement>
Predicate<T> withAnnotation
(Annotation annotation) where element is annotated with givenannotation
, including member matchingstatic <T extends AnnotatedElement>
Predicate<T> withAnnotation
(Class<? extends Annotation> annotation) where element is annotated with givenannotation
static <T extends AnnotatedElement>
Predicate<T> withAnnotations
(Annotation... annotations) where element is annotated with givenannotations
, including member matchingstatic <T extends AnnotatedElement>
Predicate<T> withAnnotations
(Class<? extends Annotation>... annotations) where element is annotated with givenannotations
withAnyParameterAnnotation
(Annotation annotation) when method/constructor has any parameter with an annotation matches givenannotations
, including member matchingwithAnyParameterAnnotation
(Class<? extends Annotation> annotationClass) when method/constructor has any parameter with an annotation matches givenannotations
withClassModifier
(int mod) when class modifier matches givenmod
withModifier
(int mod) when member modifier matches givenmod
where member name equals givenname
static <T> Predicate
<T> withNamePrefix
(String prefix) where annotated element name startsWith givenprefix
withParameters
(Class<?>... types) when method/constructor parameter types equals giventypes
withParametersAssignableFrom
(Class... types) when method/constructor parameter types assignable from giventypes
withParametersAssignableTo
(Class... types) when member parameter types assignable to giventypes
withParametersCount
(int count) when method/constructor parameters count equal givencount
static <T extends AnnotatedElement>
Predicate<T> withPattern
(String regex) where member'stoString
matches givenregex
withPrefix
(String prefix) where member name startsWith givenprefix
when member modifier is publicwithReturnType
(Class<T> type) when method return type equal giventype
withReturnTypeAssignableFrom
(Class<T> type) when method return type assignable from giventype
when field type equal giventype
withTypeAssignableTo
(Class<T> type) when field type assignable to giventype
-
Constructor Details
-
ReflectionUtilsPredicates
public ReflectionUtilsPredicates()
-
-
Method Details
-
withName
where member name equals givenname
-
withPrefix
where member name startsWith givenprefix
-
withNamePrefix
where annotated element name startsWith givenprefix
-
withPattern
where member'stoString
matches givenregex
get(Methods.of(someClass).filter(withPattern("public void .*")))
-
withAnnotation
public static <T extends AnnotatedElement> Predicate<T> withAnnotation(Class<? extends Annotation> annotation) where element is annotated with givenannotation
-
withAnnotations
public static <T extends AnnotatedElement> Predicate<T> withAnnotations(Class<? extends Annotation>... annotations) where element is annotated with givenannotations
-
withAnnotation
where element is annotated with givenannotation
, including member matching -
withAnnotations
where element is annotated with givenannotations
, including member matching -
withParameters
when method/constructor parameter types equals giventypes
-
withParametersAssignableTo
when member parameter types assignable to giventypes
-
withParametersAssignableFrom
when method/constructor parameter types assignable from giventypes
-
withParametersCount
when method/constructor parameters count equal givencount
-
withAnyParameterAnnotation
public static Predicate<Member> withAnyParameterAnnotation(Class<? extends Annotation> annotationClass) when method/constructor has any parameter with an annotation matches givenannotations
-
withAnyParameterAnnotation
when method/constructor has any parameter with an annotation matches givenannotations
, including member matching -
withType
when field type equal giventype
-
withTypeAssignableTo
when field type assignable to giventype
-
withReturnType
when method return type equal giventype
-
withReturnTypeAssignableFrom
when method return type assignable from giventype
-
withModifier
when member modifier matches givenmod
for example:
withModifier(Modifier.PUBLIC)
-
withPublic
when member modifier is public -
withStatic
-
withInterface
-
withClassModifier
when class modifier matches givenmod
for example:
withModifier(Modifier.PUBLIC)
-
isAssignable
-
toName
-
parameterTypes
-
parameterAnnotations
-
annotationTypes
-
annotationTypes
-
areAnnotationMembersMatching
-