com.lexicalscope.fluentreflection
Class ReflectionMatchers

java.lang.Object
  extended by com.lexicalscope.fluentreflection.ReflectionMatchers

public final class ReflectionMatchers
extends Object

A whole bunch of matchers suitable for selecting program elements

Author:
tim

Method Summary
static ReflectionMatcher<FluentAnnotated> annotatedWith(Class<? extends Annotation> annotation)
           
static ReflectionMatcher<FluentClass<?>> anyReflectedType()
           
static ReflectionMatcher<FluentClass<?>> assignableFrom(Class<?> klass)
           
static ReflectionMatcher<FluentClass<?>> assignableFrom(FluentClass<?> klass)
           
static ReflectionMatcher<FluentMember> canBeCalledWithArguments(Object... args)
           
static ReflectionMatcher<FluentMember> declaredBy(Class<?> declaringClass)
          Matches the declaring class of a callable
static ReflectionMatcher<FluentMember> hasArgumentCount(int argumentCount)
           
static ReflectionMatcher<FluentMember> hasArgumentList(List<Class<?>> argTypes)
           
static ReflectionMatcher<FluentMember> hasArgumentListMatching(List<org.hamcrest.Matcher<? super FluentClass<?>>> argTypes)
           
static ReflectionMatcher<FluentMember> hasArguments(Class<?>... argTypes)
           
static ReflectionMatcher<FluentMember> hasArgumentsMatching(org.hamcrest.Matcher<? super FluentClass<?>>... argTypes)
           
static ReflectionMatcher<FluentClass<?>> hasInterface(Class<?> interfac3)
           
static ReflectionMatcher<FluentMember> hasName(String name)
          Matches the name of a callable
static ReflectionMatcher<FluentMember> hasNameContaining(CharSequence substring)
          Matches a substring of the name of a callable
static ReflectionMatcher<FluentMember> hasNameEndingWith(String suffix)
          Matches a suffix of the name of a callable
static ReflectionMatcher<FluentMember> hasNameMatching(String regex)
          Matches a regular expression against the name of a callable
static ReflectionMatcher<FluentMember> hasNameStartingWith(String prefix)
          Matches a prefix of the name of a callable
static ReflectionMatcher<FluentMember> hasNoArguments()
           
static ReflectionMatcher<FluentClass<?>> hasNoInterfaces()
           
static ReflectionMatcher<FluentMember> hasNonVoidType()
           
static ReflectionMatcher<FluentClass<?>> hasNoSuperclasses()
           
static ReflectionMatcher<FluentMember> hasPropertyName(String name)
           
static ReflectionMatcher<FluentMember> hasReflectedArgumentList(List<FluentClass<?>> argTypes)
           
static ReflectionMatcher<FluentMember> hasReflectedArguments(FluentClass<?>... argTypes)
           
static ReflectionMatcher<FluentClass<?>> hasSimpleName(String simpleName)
           
static ReflectionMatcher<FluentMember> hasType(Class<?> returnType)
           
static ReflectionMatcher<FluentMember> hasType(FluentClass<?> returnType)
           
static ReflectionMatcher<FluentMember> hasType(org.hamcrest.Matcher<? super FluentClass<?>> returnType)
           
static ReflectionMatcher<FluentMember> hasVisibility(Visibility visibility)
           
static ReflectionMatcher<FluentMember> hasVoidType()
           
static ReflectionMatcher<FluentClass<?>> isAnInterface()
           
static org.hamcrest.Matcher<? super FluentMember> isDeclaredByStrictSubtypeOf(Class<?> klass)
           
static ReflectionMatcher<FluentMember> isEqualsMethod()
           
static ReflectionMatcher<FluentMember> isExistence()
           
static ReflectionMatcher<FluentMember> isFinal()
           
static ReflectionMatcher<FluentMember> isGetter()
           
static ReflectionMatcher<FluentMember> isHashCodeMethod()
           
static ReflectionMatcher<FluentMember> isMutator()
           
static ReflectionMatcher<FluentMember> isNotStatic()
           
static ReflectionMatcher<FluentMember> isPublicMethod()
           
static ReflectionMatcher<FluentMember> isQuery()
           
static ReflectionMatcher<FluentField> isReflectingOnField(Field field)
           
static ReflectionMatcher<FluentMember> isSetter()
           
static ReflectionMatcher<FluentMember> isStatic()
           
static org.hamcrest.Matcher<? super FluentClass<?>> isStrictSubtypeOf(Class<?> klass)
           
static ReflectionMatcher<FluentMember> isToStringMethod()
           
static
<T> ReflectionMatcher<T>
not(ReflectionMatcher<T> matcher)
           
static ReflectionMatcher<FluentClass<?>> reflectingOn(Class<?> klass)
           
static ReflectionMatcher<FluentConstructor<?>> reflectingOnConstructor(Constructor<?> constructor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNameStartingWith

public static ReflectionMatcher<FluentMember> hasNameStartingWith(String prefix)
Matches a prefix of the name of a callable

Parameters:
prefix - the prefix
Returns:
true iff the argument is a prefix of the name of the callable

hasNameEndingWith

public static ReflectionMatcher<FluentMember> hasNameEndingWith(String suffix)
Matches a suffix of the name of a callable

Parameters:
suffix - the suffix
Returns:
true iff the argument is a suffix of the name of the callable

hasNameMatching

public static ReflectionMatcher<FluentMember> hasNameMatching(String regex)
Matches a regular expression against the name of a callable

Parameters:
regex - the regular expression
Returns:
true iff the argument is a regular expression matching the name of the callable

hasNameContaining

public static ReflectionMatcher<FluentMember> hasNameContaining(CharSequence substring)
Matches a substring of the name of a callable

Parameters:
substring - the substring
Returns:
true iff the argument is contained within the name of the callable

hasName

public static ReflectionMatcher<FluentMember> hasName(String name)
Matches the name of a callable

Parameters:
name - the name
Returns:
true iff the argument is equal to the name of the callable

hasPropertyName

public static ReflectionMatcher<FluentMember> hasPropertyName(String name)

declaredBy

public static ReflectionMatcher<FluentMember> declaredBy(Class<?> declaringClass)
Matches the declaring class of a callable

Parameters:
declaringClass - the declaring class
Returns:
true iff the callable is declared by the argument

hasNoInterfaces

public static ReflectionMatcher<FluentClass<?>> hasNoInterfaces()

hasNoSuperclasses

public static ReflectionMatcher<FluentClass<?>> hasNoSuperclasses()

hasInterface

public static ReflectionMatcher<FluentClass<?>> hasInterface(Class<?> interfac3)

isAnInterface

public static ReflectionMatcher<FluentClass<?>> isAnInterface()

hasSimpleName

public static ReflectionMatcher<FluentClass<?>> hasSimpleName(String simpleName)

anyReflectedType

public static ReflectionMatcher<FluentClass<?>> anyReflectedType()

reflectingOn

public static ReflectionMatcher<FluentClass<?>> reflectingOn(Class<?> klass)

assignableFrom

public static ReflectionMatcher<FluentClass<?>> assignableFrom(Class<?> klass)

assignableFrom

public static ReflectionMatcher<FluentClass<?>> assignableFrom(FluentClass<?> klass)

reflectingOnConstructor

public static ReflectionMatcher<FluentConstructor<?>> reflectingOnConstructor(Constructor<?> constructor)

hasArgumentCount

public static ReflectionMatcher<FluentMember> hasArgumentCount(int argumentCount)

hasNoArguments

public static ReflectionMatcher<FluentMember> hasNoArguments()

hasArguments

public static ReflectionMatcher<FluentMember> hasArguments(Class<?>... argTypes)

canBeCalledWithArguments

public static ReflectionMatcher<FluentMember> canBeCalledWithArguments(Object... args)

hasArgumentList

public static ReflectionMatcher<FluentMember> hasArgumentList(List<Class<?>> argTypes)

hasArgumentsMatching

public static ReflectionMatcher<FluentMember> hasArgumentsMatching(org.hamcrest.Matcher<? super FluentClass<?>>... argTypes)

hasArgumentListMatching

public static ReflectionMatcher<FluentMember> hasArgumentListMatching(List<org.hamcrest.Matcher<? super FluentClass<?>>> argTypes)

hasReflectedArguments

public static ReflectionMatcher<FluentMember> hasReflectedArguments(FluentClass<?>... argTypes)

hasReflectedArgumentList

public static ReflectionMatcher<FluentMember> hasReflectedArgumentList(List<FluentClass<?>> argTypes)

hasType

public static ReflectionMatcher<FluentMember> hasType(Class<?> returnType)

hasVoidType

public static ReflectionMatcher<FluentMember> hasVoidType()

hasNonVoidType

public static ReflectionMatcher<FluentMember> hasNonVoidType()

hasType

public static ReflectionMatcher<FluentMember> hasType(FluentClass<?> returnType)

hasType

public static ReflectionMatcher<FluentMember> hasType(org.hamcrest.Matcher<? super FluentClass<?>> returnType)

annotatedWith

public static ReflectionMatcher<FluentAnnotated> annotatedWith(Class<? extends Annotation> annotation)

isStatic

public static ReflectionMatcher<FluentMember> isStatic()

isNotStatic

public static ReflectionMatcher<FluentMember> isNotStatic()

not

public static <T> ReflectionMatcher<T> not(ReflectionMatcher<T> matcher)

isQuery

public static ReflectionMatcher<FluentMember> isQuery()

isGetter

public static ReflectionMatcher<FluentMember> isGetter()

isMutator

public static ReflectionMatcher<FluentMember> isMutator()

isSetter

public static ReflectionMatcher<FluentMember> isSetter()

isExistence

public static ReflectionMatcher<FluentMember> isExistence()

isHashCodeMethod

public static ReflectionMatcher<FluentMember> isHashCodeMethod()

isEqualsMethod

public static ReflectionMatcher<FluentMember> isEqualsMethod()

isToStringMethod

public static ReflectionMatcher<FluentMember> isToStringMethod()

isPublicMethod

public static ReflectionMatcher<FluentMember> isPublicMethod()

isDeclaredByStrictSubtypeOf

public static org.hamcrest.Matcher<? super FluentMember> isDeclaredByStrictSubtypeOf(Class<?> klass)

isStrictSubtypeOf

public static org.hamcrest.Matcher<? super FluentClass<?>> isStrictSubtypeOf(Class<?> klass)

isReflectingOnField

public static ReflectionMatcher<FluentField> isReflectingOnField(Field field)

isFinal

public static ReflectionMatcher<FluentMember> isFinal()

hasVisibility

public static ReflectionMatcher<FluentMember> hasVisibility(Visibility visibility)


Copyright © 2011-2012 lexicalscope. All Rights Reserved.