public class

Matchers

extends Object
java.lang.Object
   ↳ com.google.inject.matcher.Matchers

Class Overview

Matcher implementations. Supports matching classes and methods.

Summary

Public Methods
static Matcher<AnnotatedElement> annotatedWith(Class<? extends Annotation> annotationType)
Returns a matcher which matches elements (methods, classes, etc.) with a given annotation.
static Matcher<AnnotatedElement> annotatedWith(Annotation annotation)
Returns a matcher which matches elements (methods, classes, etc.) with a given annotation.
static Matcher<Object> any()
Returns a matcher which matches any input.
static Matcher<Object> identicalTo(Object value)
Returns a matcher which matches only the given object.
static Matcher<Class> inPackage(Package targetPackage)
Returns a matcher which matches classes in the given package.
static Matcher<Class> inSubpackage(String targetPackageName)
Returns a matcher which matches classes in the given package and its subpackages.
static <T> Matcher<T> not(Matcher<? super T> p)
Inverts the given matcher.
static Matcher<Object> only(Object value)
Returns a matcher which matches objects equal to the given object.
static Matcher<Method> returns(Matcher<? super Class<?>> returnType)
Returns a matcher which matches methods with matching return types.
static Matcher<Class> subclassesOf(Class<?> superclass)
Returns a matcher which matches subclasses of the given type (as well as the given type).
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Matcher<AnnotatedElement> annotatedWith (Class<? extends Annotation> annotationType)

Returns a matcher which matches elements (methods, classes, etc.) with a given annotation.

public static Matcher<AnnotatedElement> annotatedWith (Annotation annotation)

Returns a matcher which matches elements (methods, classes, etc.) with a given annotation.

public static Matcher<Object> any ()

Returns a matcher which matches any input.

public static Matcher<Object> identicalTo (Object value)

Returns a matcher which matches only the given object.

public static Matcher<Class> inPackage (Package targetPackage)

Returns a matcher which matches classes in the given package. Packages are specific to their classloader, so classes with the same package name may not have the same package at runtime.

public static Matcher<Class> inSubpackage (String targetPackageName)

Returns a matcher which matches classes in the given package and its subpackages. Unlike inPackage(), this matches classes from any classloader.

public static Matcher<T> not (Matcher<? super T> p)

Inverts the given matcher.

public static Matcher<Object> only (Object value)

Returns a matcher which matches objects equal to the given object.

public static Matcher<Method> returns (Matcher<? super Class<?>> returnType)

Returns a matcher which matches methods with matching return types.

public static Matcher<Class> subclassesOf (Class<?> superclass)

Returns a matcher which matches subclasses of the given type (as well as the given type).