Class ReflectionUtilsPredicates

java.lang.Object
org.reflections.util.ReflectionUtilsPredicates
Direct Known Subclasses:
ReflectionUtils

public class ReflectionUtilsPredicates extends Object
helper predicates for java meta types
  • Constructor Details

    • ReflectionUtilsPredicates

      public ReflectionUtilsPredicates()
  • Method Details

    • withName

      public static <T extends Member> Predicate<T> withName(String name)
      where member name equals given name
    • withPrefix

      public static <T extends Member> Predicate<T> withPrefix(String prefix)
      where member name startsWith given prefix
    • withNamePrefix

      public static <T> Predicate<T> withNamePrefix(String prefix)
      where annotated element name startsWith given prefix
    • withPattern

      public static <T extends AnnotatedElement> Predicate<T> withPattern(String regex)
      where member's toString matches given regex
       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 given annotation
    • withAnnotations

      public static <T extends AnnotatedElement> Predicate<T> withAnnotations(Class<? extends Annotation>... annotations)
      where element is annotated with given annotations
    • withAnnotation

      public static <T extends AnnotatedElement> Predicate<T> withAnnotation(Annotation annotation)
      where element is annotated with given annotation, including member matching
    • withAnnotations

      public static <T extends AnnotatedElement> Predicate<T> withAnnotations(Annotation... annotations)
      where element is annotated with given annotations, including member matching
    • withParameters

      public static Predicate<Member> withParameters(Class<?>... types)
      when method/constructor parameter types equals given types
    • withParametersAssignableTo

      public static Predicate<Member> withParametersAssignableTo(Class... types)
      when member parameter types assignable to given types
    • withParametersAssignableFrom

      public static Predicate<Member> withParametersAssignableFrom(Class... types)
      when method/constructor parameter types assignable from given types
    • withParametersCount

      public static Predicate<Member> withParametersCount(int count)
      when method/constructor parameters count equal given count
    • withAnyParameterAnnotation

      public static Predicate<Member> withAnyParameterAnnotation(Class<? extends Annotation> annotationClass)
      when method/constructor has any parameter with an annotation matches given annotations
    • withAnyParameterAnnotation

      public static Predicate<Member> withAnyParameterAnnotation(Annotation annotation)
      when method/constructor has any parameter with an annotation matches given annotations, including member matching
    • withType

      public static <T> Predicate<Field> withType(Class<T> type)
      when field type equal given type
    • withTypeAssignableTo

      public static <T> Predicate<Field> withTypeAssignableTo(Class<T> type)
      when field type assignable to given type
    • withReturnType

      public static <T> Predicate<Method> withReturnType(Class<T> type)
      when method return type equal given type
    • withReturnTypeAssignableFrom

      public static <T> Predicate<Method> withReturnTypeAssignableFrom(Class<T> type)
      when method return type assignable from given type
    • withModifier

      public static <T extends Member> Predicate<T> withModifier(int mod)
      when member modifier matches given mod

      for example:

       withModifier(Modifier.PUBLIC)
       
    • withPublic

      public static <T extends Member> Predicate<T> withPublic()
      when member modifier is public
    • withStatic

      public static <T extends Member> Predicate<T> withStatic()
    • withInterface

      public static <T extends Member> Predicate<T> withInterface()
    • withClassModifier

      public static Predicate<Class<?>> withClassModifier(int mod)
      when class modifier matches given mod

      for example:

       withModifier(Modifier.PUBLIC)
       
    • isAssignable

      public static boolean isAssignable(Class[] childClasses, Class[] parentClasses)
    • toName

      private static String toName(Object input)
    • parameterTypes

      private static Class[] parameterTypes(Member member)
    • parameterAnnotations

      private static Set<Annotation> parameterAnnotations(Member member)
    • annotationTypes

      private static Set<Class<? extends Annotation>> annotationTypes(Collection<Annotation> annotations)
    • annotationTypes

      private static Class<? extends Annotation>[] annotationTypes(Annotation[] annotations)
    • areAnnotationMembersMatching

      private static boolean areAnnotationMembersMatching(Annotation annotation1, Annotation annotation2)