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