public final class ElementMatchers extends Object
ElementMatcher
s.Modifier and Type | Method and Description |
---|---|
static <T extends AnnotationDescription> |
annotationType(Class<? extends Annotation> type)
Matches if an annotation is of a given type.
|
static <T extends AnnotationDescription> |
annotationType(ElementMatcher<? super TypeDescription> matcher)
Matches if an annotation's type matches the supplied matcher.
|
static <T extends AnnotationDescription> |
annotationType(TypeDescription type)
Matches if an annotation is of a given type.
|
static <T> ElementMatcher.Junction<T> |
any()
Creates a matcher that always returns
true . |
static <T extends AnnotationDescription> |
anyOf(Annotation... value)
Creates a matcher that matches any of the given annotations as
AnnotationDescription s
by the Object.equals(Object) method. |
static <T extends MethodDescription> |
anyOf(Constructor<?>... value)
Creates a matcher that matches any of the given constructors as
MethodDescription s
by the Object.equals(Object) method. |
static <T extends FieldDescription> |
anyOf(Field... value)
Creates a matcher that matches any of the given fields as
FieldDescription s
by the Object.equals(Object) method. |
static <T> ElementMatcher.Junction<T> |
anyOf(Iterable<?> values)
Creates a matcher that matches any of the given objects by the
Object.equals(Object) method. |
static <T extends MethodDescription> |
anyOf(Method... value)
Creates a matcher that matches any of the given methods as
MethodDescription s
by the Object.equals(Object) method. |
static <T> ElementMatcher.Junction<T> |
anyOf(Object... value)
Creates a matcher that matches any of the given objects by the
Object.equals(Object) method. |
static <T extends TypeDefinition> |
anyOf(Type... value)
Creates a matcher that matches any of the given types as
TypeDescription s
by the Object.equals(Object) method. |
static <T> ElementMatcher.Junction<T> |
cached(ElementMatcher<? super T> matcher,
ConcurrentMap<? super T,Boolean> map)
Wraps another matcher but caches the result of previously matched elements.
|
static <T> ElementMatcher.Junction<T> |
cached(ElementMatcher<? super T> matcher,
int evictionSize)
Wraps another matcher but caches the result of previously matched elements.
|
static <T extends MethodDescription> |
canThrow(Class<? extends Throwable> exceptionType)
Matches a
MethodDescription by its capability to throw a given
checked exception. |
static <T extends MethodDescription> |
canThrow(TypeDescription exceptionType)
Matches a
MethodDescription by its capability to throw a given
checked exception. |
static <T extends AnnotationSource> |
declaresAnnotation(ElementMatcher<? super AnnotationDescription> matcher)
Matches an
AnnotationSource to declare any annotation
that matches the given matcher. |
static <T extends MethodDescription> |
declaresException(Class<? extends Throwable> exceptionType)
Matches a method that declares the given generic exception type as a (erased) exception type.
|
static <T extends MethodDescription> |
declaresException(TypeDescription exceptionType)
Matches a method that declares the given generic exception type as a (erased) exception type.
|
static <T extends TypeDefinition> |
declaresField(ElementMatcher<? super FieldDescription> matcher)
Matches a type by a another matcher that is applied on any of its declared fields.
|
static <T extends MethodDescription> |
declaresGenericException(ElementMatcher<? super Iterable<? extends TypeDescription.Generic>> matcher)
Matches a method's generic exception types against the provided matcher.
|
static <T extends MethodDescription> |
declaresGenericException(Type exceptionType)
Matches a method that declares the given generic exception type.
|
static <T extends MethodDescription> |
declaresGenericException(TypeDescription.Generic exceptionType)
Matches a method that declares the given generic exception type.
|
static <T extends TypeDefinition> |
declaresMethod(ElementMatcher<? super MethodDescription> matcher)
Matches a type by a another matcher that is applied on any of its declared methods.
|
static <T extends FieldDescription> |
definedField(ElementMatcher<? super FieldDescription.InDefinedShape> matcher)
Matches a field in its defined shape.
|
static <T extends MethodDescription> |
definedMethod(ElementMatcher<? super MethodDescription.InDefinedShape> matcher)
Matches a method in its defined shape.
|
static <T extends ParameterDescription> |
definedParameter(ElementMatcher<? super ParameterDescription.InDefinedShape> matcher)
Matches a parameter in its defined shape.
|
static <T extends TypeDescription.Generic> |
erasure(Class<?> type)
Matches a generic type's erasure against the provided type.
|
static <T extends TypeDescription.Generic> |
erasure(ElementMatcher<? super TypeDescription> matcher)
Converts a matcher for a type description into a matcher for the matched type's erasure.
|
static <T extends TypeDescription.Generic> |
erasure(TypeDescription type)
Matches a generic type's erasure against the provided type.
|
static <T extends Iterable<? extends TypeDescription.Generic>> |
erasures(Class<?>... type)
Matches an iteration of generic types' erasures against the provided types.
|
static <T extends Iterable<? extends TypeDescription.Generic>> |
erasures(ElementMatcher<? super Iterable<? extends TypeDescription>> matcher)
Applies the provided matchers to an iteration og generic types' erasures.
|
static <T extends Iterable<? extends TypeDescription.Generic>> |
erasures(Iterable<? extends TypeDescription> types)
Matches an iteration of generic types' erasures against the provided types.
|
static <T extends Iterable<? extends TypeDescription.Generic>> |
erasures(TypeDescription... type)
Matches an iteration of generic types' erasures against the provided types.
|
static <T> ElementMatcher.Junction<T> |
failSafe(ElementMatcher<? super T> matcher)
Wraps another matcher to assure that an element is not matched in case that the matching causes an
Exception . |
static <T extends FieldDescription> |
fieldType(Class<?> fieldType)
Matches a field's raw type against the provided matcher.
|
static <T extends FieldDescription> |
fieldType(ElementMatcher<? super TypeDescription> matcher)
Matches a field's raw type against the provided matcher.
|
static <T extends FieldDescription> |
fieldType(TypeDescription fieldType)
Matches a field's raw type against the provided matcher.
|
static <T extends FieldDescription> |
genericFieldType(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches a field's generic type against the provided matcher.
|
static <T extends FieldDescription> |
genericFieldType(Type fieldType)
Matches a field's generic type against the provided matcher.
|
static <T extends FieldDescription> |
genericFieldType(TypeDescription.Generic fieldType)
Matches a field's generic type against the provided matcher.
|
static <T extends TypeDescription> |
hasAnnotation(ElementMatcher<? super AnnotationDescription> matcher)
Matches a list of annotations by a given matcher on a type that declared these annotations or inherited them
from its super classes.
|
static <T extends ClassLoader> |
hasChild(ElementMatcher<? super ClassLoader> matcher)
Matches all class loaders in the hierarchy of the matched class loader against a given matcher.
|
static <T extends NamedElement.WithDescriptor> |
hasDescriptor(String descriptor)
Matches a
NamedElement.WithDescriptor 's descriptor against a given value. |
static <T extends TypeDescription> |
hasGenericSuperClass(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches any type description that declares a super class (but not interface) that matches the provided matcher.
|
static <T extends TypeDescription> |
hasGenericSuperType(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches any type description that declares a super type that matches the provided matcher.
|
static <T extends ParameterDescription> |
hasGenericType(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches a method parameter by its generic type.
|
static <T extends MethodDescription> |
hasMethodName(String internalName)
Matches a method against its internal name such that constructors and type initializers are matched appropriately.
|
static <T extends MethodDescription> |
hasParameters(ElementMatcher<? super Iterable<? extends ParameterDescription>> matcher)
Matches a
MethodDescription by validating that its parameters
fulfill a given constraint. |
static <T extends MethodDescription> |
hasSignature(MethodDescription.SignatureToken token)
Only matches method descriptions that yield the provided signature token.
|
static <T extends TypeDescription> |
hasSuperClass(ElementMatcher<? super TypeDescription> matcher)
Matches any type description that declares a super class (but not interface) that matches the provided matcher.
|
static <T extends TypeDescription> |
hasSuperType(ElementMatcher<? super TypeDescription> matcher)
Matches any type description that declares a super type that matches the provided matcher.
|
static <T extends ParameterDescription> |
hasType(ElementMatcher<? super TypeDescription> matcher)
Matches a parameter's type by the given matcher.
|
static <T extends TypeDescription> |
inheritsAnnotation(Class<?> type)
Matches any annotations by their type on a type that declared these annotations or inherited them from its
super classes.
|
static <T extends TypeDescription> |
inheritsAnnotation(ElementMatcher<? super TypeDescription> matcher)
Matches any annotations by a given matcher on a type that declared these annotations or inherited them from its
super classes.
|
static <T extends TypeDescription> |
inheritsAnnotation(TypeDescription type)
Matches any annotations by their type on a type that declared these annotations or inherited them from its
super classes.
|
static <T extends AnnotationDescription> |
is(Annotation annotation)
Exactly matches a given annotation as an
AnnotationDescription . |
static <T extends MethodDescription> |
is(Constructor<?> constructor)
Exactly matches a given constructor as a
MethodDescription in its defined shape. |
static <T extends FieldDescription> |
is(Field field)
Exactly matches a given field as a
FieldDescription in its defined shape. |
static <T extends FieldDescription> |
is(FieldDescription.InDefinedShape field)
Exactly matches a given field as a
FieldDescription in its defined shape. |
static <T extends MethodDescription> |
is(Method method)
Exactly matches a given method as a
MethodDescription in its defined shape. |
static <T extends MethodDescription> |
is(MethodDescription.InDefinedShape method)
Exactly matches a given method or constructor as a
MethodDescription in its defined shape. |
static <T> ElementMatcher.Junction<T> |
is(Object value)
Matches the given value which can also be
null by the Object.equals(Object) method or
by a null-check. |
static <T extends ParameterDescription> |
is(ParameterDescription.InDefinedShape parameter)
Exactly matches a given parameter as a
ParameterDescription in its defined shape. |
static <T extends TypeDefinition> |
is(Type type)
Exactly matches a given type as a
TypeDescription . |
static <T extends ModifierReviewable.OfAbstraction> |
isAbstract()
Matches a
ModifierReviewable.OfAbstraction that is abstract . |
static <T extends ByteCodeElement> |
isAccessibleTo(Class<?> type)
Matches a
ByteCodeElement that is accessible to a given Class . |
static <T extends ByteCodeElement> |
isAccessibleTo(TypeDescription type)
Matches a
ByteCodeElement that is accessible to a given Class . |
static <T extends AnnotationSource> |
isAnnotatedWith(Class<? extends Annotation> type)
Matches an
AnnotationSource for declared annotations. |
static <T extends AnnotationSource> |
isAnnotatedWith(ElementMatcher<? super TypeDescription> matcher)
Matches an
AnnotationSource for declared annotations. |
static <T extends AnnotationSource> |
isAnnotatedWith(TypeDescription type)
Matches an
AnnotationSource for declared annotations. |
static <T extends TypeDescription> |
isAnnotation()
Matches a
TypeDescription that is an annotation type. |
static <T extends TypeDefinition> |
isArray()
Matches a type if it is an array type.
|
static <T extends ClassLoader> |
isBootstrapClassLoader()
Matches exactly the bootstrap
ClassLoader . |
static <T extends ModifierReviewable.ForMethodDescription> |
isBridge()
Matches a
MethodDescription that is a bridge. |
static <T extends ClassLoader> |
isChildOf(ClassLoader classLoader)
Matches any class loader that is either the given class loader or a child of the given class loader.
|
static <T extends MethodDescription> |
isClone()
Only matches the
Object.clone() method, also if it was overridden. |
static <T extends MethodDescription> |
isConstructor()
Only matches method descriptions that represent a
Constructor . |
static <T extends ByteCodeElement> |
isDeclaredBy(Class<?> type)
Matches a
ByteCodeElement for being declared by a given Class . |
static <T extends ByteCodeElement> |
isDeclaredBy(ElementMatcher<? super TypeDescription> matcher)
Matches a
ByteCodeElement for being declared by a TypeDescription that is matched by the given matcher. |
static <T extends ByteCodeElement> |
isDeclaredBy(TypeDescription type)
Matches a
ByteCodeElement for being declared by a given TypeDescription . |
static <T extends ByteCodeElement> |
isDeclaredByGeneric(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches a
ByteCodeElement for being declared by a TypeDescription.Generic that is matched by the given matcher. |
static <T extends ByteCodeElement> |
isDeclaredByGeneric(Type type)
Matches a
ByteCodeElement for being declared by a given generic Type . |
static <T extends ByteCodeElement> |
isDeclaredByGeneric(TypeDescription.Generic type)
Matches a
ByteCodeElement for being declared by a given TypeDescription.Generic . |
static <T extends MethodDescription> |
isDefaultConstructor()
Matches a default constructor, i.e.
|
static <T extends MethodDescription> |
isDefaultFinalizer()
Only matches the
Object.finalize() method if it was not overridden. |
static <T extends MethodDescription> |
isDefaultMethod()
Only matches Java 8 default methods.
|
static <T extends ModifierReviewable.OfEnumeration> |
isEnum()
Matches a
ModifierReviewable.OfEnumeration that is an enum or a field holding an enum. |
static <T extends MethodDescription> |
isEquals()
Only matches the
Object.equals(Object) method, also if it was overridden. |
static <T extends ClassLoader> |
isExtensionClassLoader()
Matches exactly the extension
ClassLoader . |
static <T extends ModifierReviewable> |
isFinal()
Matches a
ModifierReviewable that is final . |
static <T extends MethodDescription> |
isFinalizer()
Only matches the
Object.finalize() method, even if it was overridden. |
static <T extends MethodDescription> |
isGenericGetter(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches any Java bean getter method which returns an value with a type matches the supplied matcher.
|
static <T extends MethodDescription> |
isGenericGetter(Type type)
Matches any Java bean getter method which returns the given type.
|
static <T extends MethodDescription> |
isGenericGetter(TypeDescription.Generic type)
Matches any Java bean getter method which returns the given type.
|
static <T extends MethodDescription> |
isGenericSetter(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches any Java bean setter method which takes an argument that matches the supplied matcher.
|
static <T extends MethodDescription> |
isGenericSetter(Type type)
Matches any Java bean setter method which takes an argument the given type.
|
static <T extends MethodDescription> |
isGenericSetter(TypeDescription.Generic type)
Matches any Java bean setter method which takes an argument the given type.
|
static <T extends MethodDescription> |
isGetter()
Matches any Java bean getter method.
|
static <T extends MethodDescription> |
isGetter(Class<?> type)
Matches any Java bean getter method which returns the given type.
|
static <T extends MethodDescription> |
isGetter(ElementMatcher<? super TypeDescription> matcher)
Matches any Java bean getter method which returns an value with a type matches the supplied matcher.
|
static <T extends MethodDescription> |
isGetter(String property)
An element matcher that matches any getter for the given property.
|
static <T extends MethodDescription> |
isGetter(TypeDescription type)
Matches any Java bean getter method which returns the given type.
|
static <T extends MethodDescription> |
isHashCode()
Only matches the
Object.hashCode() method, also if it was overridden. |
static <T extends TypeDescription> |
isInterface()
Matches a
TypeDescription that is an interface. |
static <T extends ParameterDescription> |
isMandated()
Matches a parameter description for a
mandated parameter. |
static <T extends MethodDescription> |
isMethod()
Only matches method descriptions that represent a
Method . |
static <T extends NamedElement.WithOptionalName> |
isNamed()
Matches a
NamedElement.WithOptionalName for having an explicit name. |
static <T extends ModifierReviewable.ForMethodDescription> |
isNative()
Matches a
MethodDescription that is native . |
static <T extends MethodDescription> |
isOverriddenFrom(Class<?> type)
Matches any virtual method with a signature that is compatible to a method that is declared the supplied type.
|
static <T extends MethodDescription> |
isOverriddenFrom(ElementMatcher<? super TypeDescription> matcher)
Matches any virtual method with a signature that is compatible to a method that is declared by a type that matches the supplied matcher.
|
static <T extends MethodDescription> |
isOverriddenFrom(TypeDescription type)
Matches any virtual method with a signature that is compatible to a method that is declared the supplied type.
|
static <T extends MethodDescription> |
isOverriddenFromGeneric(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches any virtual method with a signature that is compatible to a method that is declared by a type that matches the supplied matcher.
|
static <T extends MethodDescription> |
isOverriddenFromGeneric(Type type)
Matches any virtual method with a signature that is compatible to a method that is declared the supplied type.
|
static <T extends MethodDescription> |
isOverriddenFromGeneric(TypeDescription.Generic type)
Matches any virtual method with a signature that is compatible to a method that is declared the supplied type.
|
static <T extends ModifierReviewable.OfByteCodeElement> |
isPackagePrivate()
Matches a
ModifierReviewable that is package-private. |
static <T extends ClassLoader> |
isParentOf(ClassLoader classLoader)
Matches any class loader that is either the given class loader or a parent of the given class loader.
|
static <T extends TypeDefinition> |
isPrimitive()
Matches a type if it is primitive.
|
static <T extends ModifierReviewable.OfByteCodeElement> |
isPrivate()
Matches a
ModifierReviewable that is private . |
static <T extends ModifierReviewable.OfByteCodeElement> |
isProtected()
Matches a
ModifierReviewable that is protected . |
static <T extends ModifierReviewable.OfByteCodeElement> |
isPublic()
Matches a
ModifierReviewable that is public . |
static <T extends TypeDefinition> |
isRecord()
Matches a type if it is a record type.
|
static <T extends MethodDescription> |
isSetter()
Matches any Java bean setter method.
|
static <T extends MethodDescription> |
isSetter(Class<?> type)
Matches any Java bean setter method which takes an argument the given type.
|
static <T extends MethodDescription> |
isSetter(ElementMatcher<? super TypeDescription> matcher)
Matches any Java bean setter method which takes an argument that matches the supplied matcher.
|
static <T extends MethodDescription> |
isSetter(String property)
An element matcher that matches any setter for the given property.
|
static <T extends MethodDescription> |
isSetter(TypeDescription type)
Matches any Java bean setter method which takes an argument the given type.
|
static <T extends ModifierReviewable.OfByteCodeElement> |
isStatic()
Matches a
ModifierReviewable that is static . |
static <T extends ModifierReviewable.ForMethodDescription> |
isStrict()
Matches a
MethodDescription that is strictfp . |
static <T extends TypeDescription> |
isSubTypeOf(Class<?> type)
Matches any type description that is a subtype of the given type.
|
static <T extends TypeDescription> |
isSubTypeOf(TypeDescription type)
Matches any type description that is a subtype of the given type.
|
static <T extends TypeDescription> |
isSuperTypeOf(Class<?> type)
Matches any type description that is a super type of the given type.
|
static <T extends TypeDescription> |
isSuperTypeOf(TypeDescription type)
Matches any type description that is a super type of the given type.
|
static <T extends ModifierReviewable.ForMethodDescription> |
isSynchronized()
Matches a
MethodDescription that is synchronized . |
static <T extends ModifierReviewable> |
isSynthetic()
Matches a
ModifierReviewable that is synthetic. |
static <T extends ClassLoader> |
isSystemClassLoader()
Matches exactly the system
ClassLoader . |
static <T extends MethodDescription> |
isToString()
Only matches the
Object.toString() method, also if it was overridden. |
static <T extends FieldDescription> |
isTransient()
Matches a
transient field. |
static <T extends MethodDescription> |
isTypeInitializer()
Only matches method descriptions that represent a
Class type initializer. |
static <T extends ModifierReviewable.ForMethodDescription> |
isVarArgs()
Matches a
MethodDescription that is a var-args. |
static <T extends TypeDefinition> |
isVariable(ElementMatcher<? super NamedElement> matcher)
Matches a type variable with the given name.
|
static <T extends TypeDefinition> |
isVariable(String symbol)
Matches a type variable with the given name.
|
static <T extends MethodDescription> |
isVirtual()
Matches any method that is virtual, i.e.
|
static <T extends ByteCodeElement> |
isVisibleTo(Class<?> type)
Matches a
ByteCodeElement that is visible to a given Class . |
static <T extends ByteCodeElement> |
isVisibleTo(TypeDescription type)
Matches a
ByteCodeElement that is visible to a given TypeDescription . |
static <T extends FieldDescription> |
isVolatile()
Matches a
volatile field. |
static <T extends NamedElement> |
nameContains(String infix)
Matches a
NamedElement for an infix of its name. |
static <T extends NamedElement> |
nameContainsIgnoreCase(String infix)
Matches a
NamedElement for an infix of its name. |
static <T extends NamedElement> |
named(String name)
Matches a
NamedElement for its exact name. |
static <T extends NamedElement> |
namedIgnoreCase(String name)
Matches a
NamedElement for its name. |
static <T extends NamedElement> |
namedOneOf(String... names)
Matches a
NamedElement for its membership of a set. |
static <T extends NamedElement> |
nameEndsWith(String suffix)
Matches a
NamedElement for its name's suffix. |
static <T extends NamedElement> |
nameEndsWithIgnoreCase(String suffix)
Matches a
NamedElement for its name's suffix. |
static <T extends NamedElement> |
nameMatches(String regex)
Matches a
NamedElement name against a regular expression. |
static <T extends NamedElement> |
nameStartsWith(String prefix)
Matches a
NamedElement for its name's prefix. |
static <T extends NamedElement> |
nameStartsWithIgnoreCase(String prefix)
Matches a
NamedElement for its name's prefix. |
static <T> ElementMatcher.Junction<T> |
none()
Creates a matcher that always returns
false . |
static <T extends AnnotationDescription> |
noneOf(Annotation... value)
Creates a matcher that matches none of the given annotations as
AnnotationDescription s
by the Object.equals(Object) method. |
static <T extends MethodDescription> |
noneOf(Constructor<?>... value)
Creates a matcher that matches none of the given constructors as
MethodDescription s
by the Object.equals(Object) method. |
static <T extends FieldDescription> |
noneOf(Field... value)
Creates a matcher that matches none of the given methods as
FieldDescription s
by the Object.equals(Object) method. |
static <T> ElementMatcher.Junction<T> |
noneOf(Iterable<?> values)
Creates a matcher that matches none of the given objects by the
Object.equals(Object) method. |
static <T extends MethodDescription> |
noneOf(Method... value)
Creates a matcher that matches none of the given methods as
MethodDescription s
by the Object.equals(Object) method. |
static <T> ElementMatcher.Junction<T> |
noneOf(Object... value)
Creates a matcher that matches none of the given objects by the
Object.equals(Object) method. |
static <T extends TypeDefinition> |
noneOf(Type... value)
Creates a matcher that matches none of the given types as
TypeDescription s
by the Object.equals(Object) method. |
static <T> ElementMatcher.Junction<T> |
not(ElementMatcher<? super T> matcher)
Inverts another matcher.
|
static <T extends TypeDefinition> |
ofSort(ElementMatcher<? super TypeDefinition.Sort> matcher)
Matches generic type descriptions of the given sort.
|
static <T extends TypeDefinition> |
ofSort(TypeDefinition.Sort sort)
Matches generic type descriptions of the given sort.
|
static <T extends ClassLoader> |
ofType(ElementMatcher<? super TypeDescription> matcher)
Matches a class loader's type unless it is the bootstrap class loader which is never matched.
|
static <T extends MethodDescription> |
returns(Class<?> type)
Matches
MethodDescription s that return a given erasure type. |
static <T extends MethodDescription> |
returns(ElementMatcher<? super TypeDescription> matcher)
Matches a method's return type's erasure by the given matcher.
|
static <T extends MethodDescription> |
returns(TypeDescription type)
Matches
MethodDescription s that return a given erasure type. |
static <T extends MethodDescription> |
returnsGeneric(ElementMatcher<? super TypeDescription.Generic> matcher)
Matches
MethodDescription s that match a matched method's return type. |
static <T extends MethodDescription> |
returnsGeneric(Type type)
Matches
MethodDescription s that return a given generic type. |
static <T extends MethodDescription> |
returnsGeneric(TypeDescription.Generic type)
Matches
MethodDescription s that returns a given
TypeDescription . |
static <T extends JavaModule> |
supportsModules()
Matches a module if it exists, i.e.
|
static <T extends MethodDescription> |
takesArgument(int index,
Class<?> type)
Matches
MethodDescription s that define a given generic type as a parameter at the given index. |
static <T extends MethodDescription> |
takesArgument(int index,
ElementMatcher<? super TypeDescription> matcher)
Matches
MethodDescription s that define a type erasure as a parameter at the given index that matches the supplied matcher. |
static <T extends MethodDescription> |
takesArgument(int index,
TypeDescription type)
Matches
MethodDescription s that define a given type erasure as a parameter at the given index. |
static <T extends MethodDescription> |
takesArguments(Class<?>... type)
Matches a method description that takes the provided raw arguments.
|
static <T extends MethodDescription> |
takesArguments(ElementMatcher<? super Iterable<? extends TypeDescription>> matchers)
Matches a
MethodDescription by applying an iterable collection of element matcher on any parameter's TypeDescription . |
static <T extends MethodDescription> |
takesArguments(int length)
Matches a
MethodDescription by the number of its parameters. |
static <T extends MethodDescription> |
takesArguments(Iterable<? extends TypeDescription> types)
Matches a method description that takes the provided raw arguments.
|
static <T extends MethodDescription> |
takesArguments(TypeDescription... type)
Matches a method description that takes the provided raw arguments.
|
static <T extends MethodDescription> |
takesGenericArgument(int index,
ElementMatcher<? super TypeDescription.Generic> matcher)
Matches
MethodDescription s that define a given generic type as a parameter at the given index. |
static <T extends MethodDescription> |
takesGenericArgument(int index,
Type type)
Matches
MethodDescription s that define a given generic type as a parameter at the given index. |
static <T extends MethodDescription> |
takesGenericArgument(int index,
TypeDescription.Generic type)
Matches
MethodDescription s that define a given generic type as a parameter at the given index. |
static <T extends MethodDescription> |
takesGenericArguments(ElementMatcher<? super Iterable<? extends TypeDescription.Generic>> matchers)
Matches a
MethodDescription by applying an iterable collection of element matcher on any parameter's TypeDescription.Generic . |
static <T extends MethodDescription> |
takesGenericArguments(List<? extends TypeDefinition> types)
Matches a method description that takes the provided generic arguments.
|
static <T extends MethodDescription> |
takesGenericArguments(Type... type)
Matches a method description that takes the provided generic arguments.
|
static <T extends MethodDescription> |
takesGenericArguments(TypeDefinition... type)
Matches a method description that takes the provided generic arguments.
|
static <T extends MethodDescription> |
takesNoArguments()
Matches a
MethodDescription with no parameters. |
static <T extends AnnotationDescription> |
targetsElement(ElementType elementType)
Matches if an annotation can target a given element type.
|
static <T> ElementMatcher.Junction<Iterable<? extends T>> |
whereAny(ElementMatcher<? super T> matcher)
Matches an iterable by assuring that at least one element of the iterable collection matches the
provided matcher.
|
static <T> ElementMatcher.Junction<Iterable<? extends T>> |
whereNone(ElementMatcher<? super T> matcher)
Matches an iterable by assuring that no element of the iterable collection matches the provided matcher.
|
public static <T> ElementMatcher.Junction<T> failSafe(ElementMatcher<? super T> matcher)
Exception
.T
- The type of the matched object.matcher
- The element matcher that potentially throws an exception.false
in case that the given matcher throws an exception.public static <T> ElementMatcher.Junction<T> cached(ElementMatcher<? super T> matcher, ConcurrentMap<? super T,Boolean> map)
Wraps another matcher but caches the result of previously matched elements. Caching can be important if a matcher requires expensive calculations.
Warning: The supplied map can however introduce a memory leak as the matched elements are stored within the map. It is therefore important to dereference this matcher at some point or to regularly evict entries from the supplied map.
T
- The type of the matched object.matcher
- The actual matcher for which the results are cached.map
- The map for storing results of previously matched elements.public static <T> ElementMatcher.Junction<T> cached(ElementMatcher<? super T> matcher, int evictionSize)
Wraps another matcher but caches the result of previously matched elements. Caching can be important if a matcher requires expensive calculations.
Warning: The cache will hold evictionSize
elements and evict a random element once the cache
contains more than the specified amount of elements. Cached elements are referenced strongly and might cause
a memory leak if instance are of a significant size. Using cached(ElementMatcher, ConcurrentMap)
allows for explicit control over cache eviction.
T
- The type of the matched object.matcher
- The actual matcher for which the results are cached.evictionSize
- The maximum amount of elements that are stored in the cache. Must be a positive number.public static <T> ElementMatcher.Junction<T> is(Object value)
null
by the Object.equals(Object)
method or
by a null-check.T
- The type of the matched object.value
- The value that is to be matched.public static <T extends FieldDescription> ElementMatcher.Junction<T> is(Field field)
FieldDescription
in its defined shape.T
- The type of the matched object.field
- The field to match by its descriptionpublic static <T extends FieldDescription> ElementMatcher.Junction<T> is(FieldDescription.InDefinedShape field)
FieldDescription
in its defined shape.T
- The type of the matched object.field
- The field to match by its descriptionpublic static <T extends FieldDescription> ElementMatcher.Junction<T> definedField(ElementMatcher<? super FieldDescription.InDefinedShape> matcher)
T
- The matched object's type.matcher
- The matcher to apply to the matched field's defined shape.public static <T extends MethodDescription> ElementMatcher.Junction<T> is(Method method)
MethodDescription
in its defined shape.T
- The type of the matched object.method
- The method to match by its descriptionpublic static <T extends MethodDescription> ElementMatcher.Junction<T> is(Constructor<?> constructor)
MethodDescription
in its defined shape.T
- The type of the matched object.constructor
- The constructor to match by its descriptionpublic static <T extends MethodDescription> ElementMatcher.Junction<T> is(MethodDescription.InDefinedShape method)
MethodDescription
in its defined shape.T
- The type of the matched object.method
- The method to match by its descriptionpublic static <T extends MethodDescription> ElementMatcher.Junction<T> definedMethod(ElementMatcher<? super MethodDescription.InDefinedShape> matcher)
T
- The matched object's type.matcher
- The matcher to apply to the matched method's defined shape.public static <T extends ParameterDescription> ElementMatcher.Junction<T> is(ParameterDescription.InDefinedShape parameter)
ParameterDescription
in its defined shape.T
- The type of the matched object.parameter
- The parameter to match by its descriptionpublic static <T extends ParameterDescription> ElementMatcher.Junction<T> definedParameter(ElementMatcher<? super ParameterDescription.InDefinedShape> matcher)
T
- The matched object's type.matcher
- The matcher to apply to the matched parameter's defined shape.public static <T extends ParameterDescription> ElementMatcher.Junction<T> hasType(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to the parameter's type.public static <T extends ParameterDescription> ElementMatcher.Junction<T> hasGenericType(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to a parameter's generic type.public static <T extends ParameterDescription> ElementMatcher.Junction<T> isMandated()
mandated
parameter.T
- The type of the matched object.mandated
parameter.public static <T extends TypeDefinition> ElementMatcher.Junction<T> is(Type type)
TypeDescription
.T
- The type of the matched object.type
- The type to match by its descriptionpublic static <T extends AnnotationDescription> ElementMatcher.Junction<T> is(Annotation annotation)
AnnotationDescription
.T
- The type of the matched object.annotation
- The annotation to match by its description.public static <T> ElementMatcher.Junction<T> not(ElementMatcher<? super T> matcher)
T
- The type of the matched object.matcher
- The matcher to invert.matcher
.public static <T> ElementMatcher.Junction<T> any()
true
.T
- The type of the matched object.public static <T> ElementMatcher.Junction<T> none()
false
.T
- The type of the matched object.public static <T> ElementMatcher.Junction<T> anyOf(Object... value)
Creates a matcher that matches any of the given objects by the Object.equals(Object)
method.
None of the values must be null
.
Important: This method cannot be used interchangeably with any of its overloaded versions which also apply a type conversion.
T
- The type of the matched object.value
- The input values to be compared against.public static <T> ElementMatcher.Junction<T> anyOf(Iterable<?> values)
Creates a matcher that matches any of the given objects by the Object.equals(Object)
method.
None of the values must be null
.
Important: This method cannot be used interchangeably with any of the overloaded versions of anyOf(Object...)
which also apply a type conversion.
T
- The type of the matched object.values
- The input values to be compared against.public static <T extends TypeDefinition> ElementMatcher.Junction<T> anyOf(Type... value)
TypeDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Constructor<?>... value)
MethodDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Method... value)
MethodDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends FieldDescription> ElementMatcher.Junction<T> anyOf(Field... value)
FieldDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends AnnotationDescription> ElementMatcher.Junction<T> anyOf(Annotation... value)
AnnotationDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T> ElementMatcher.Junction<T> noneOf(Object... value)
Object.equals(Object)
method.
None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T> ElementMatcher.Junction<T> noneOf(Iterable<?> values)
Object.equals(Object)
method.
None of the values must be null
.T
- The type of the matched object.values
- The input values to be compared against.public static <T extends TypeDefinition> ElementMatcher.Junction<T> noneOf(Type... value)
TypeDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends MethodDescription> ElementMatcher.Junction<T> noneOf(Constructor<?>... value)
MethodDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends MethodDescription> ElementMatcher.Junction<T> noneOf(Method... value)
MethodDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends FieldDescription> ElementMatcher.Junction<T> noneOf(Field... value)
FieldDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T extends AnnotationDescription> ElementMatcher.Junction<T> noneOf(Annotation... value)
AnnotationDescription
s
by the Object.equals(Object)
method. None of the values must be null
.T
- The type of the matched object.value
- The input values to be compared against.public static <T> ElementMatcher.Junction<Iterable<? extends T>> whereAny(ElementMatcher<? super T> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to each element.public static <T> ElementMatcher.Junction<Iterable<? extends T>> whereNone(ElementMatcher<? super T> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to each element.public static <T extends TypeDescription.Generic> ElementMatcher.Junction<T> erasure(Class<?> type)
T
- The type of the matched object.type
- The type to match a generic type's erasure against.public static <T extends TypeDescription.Generic> ElementMatcher.Junction<T> erasure(TypeDescription type)
T
- The type of the matched object.type
- The type to match a generic type's erasure against.public static <T extends TypeDescription.Generic> ElementMatcher.Junction<T> erasure(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The matcher to match the matched object's raw type against.public static <T extends Iterable<? extends TypeDescription.Generic>> ElementMatcher.Junction<T> erasures(Class<?>... type)
T
- The type of the matched object.type
- The types to match.public static <T extends Iterable<? extends TypeDescription.Generic>> ElementMatcher.Junction<T> erasures(TypeDescription... type)
T
- The type of the matched object.type
- The types to match.public static <T extends Iterable<? extends TypeDescription.Generic>> ElementMatcher.Junction<T> erasures(Iterable<? extends TypeDescription> types)
T
- The type of the matched object.types
- The types to match.public static <T extends Iterable<? extends TypeDescription.Generic>> ElementMatcher.Junction<T> erasures(ElementMatcher<? super Iterable<? extends TypeDescription>> matcher)
T
- The type of the matched object.matcher
- The matcher to apply at the erased types.public static <T extends TypeDefinition> ElementMatcher.Junction<T> isVariable(String symbol)
T
- The type of the matched object.symbol
- The name of the type variable to be match.public static <T extends TypeDefinition> ElementMatcher.Junction<T> isVariable(ElementMatcher<? super NamedElement> matcher)
T
- The type of the matched object.matcher
- A matcher for the type variable's name.public static <T extends NamedElement> ElementMatcher.Junction<T> named(String name)
NamedElement
for its exact name.T
- The type of the matched object.name
- The expected name.public static <T extends NamedElement> ElementMatcher.Junction<T> namedOneOf(String... names)
NamedElement
for its membership of a set.T
- The type of the matched object.names
- The set of expected names.public static <T extends NamedElement> ElementMatcher.Junction<T> namedIgnoreCase(String name)
NamedElement
for its name. The name's
capitalization is ignored.T
- The type of the matched object.name
- The expected name.public static <T extends NamedElement> ElementMatcher.Junction<T> nameStartsWith(String prefix)
NamedElement
for its name's prefix.T
- The type of the matched object.prefix
- The expected name's prefix.public static <T extends NamedElement> ElementMatcher.Junction<T> nameStartsWithIgnoreCase(String prefix)
NamedElement
for its name's prefix. The name's
capitalization is ignored.T
- The type of the matched object.prefix
- The expected name's prefix.public static <T extends NamedElement> ElementMatcher.Junction<T> nameEndsWith(String suffix)
NamedElement
for its name's suffix.T
- The type of the matched object.suffix
- The expected name's suffix.public static <T extends NamedElement> ElementMatcher.Junction<T> nameEndsWithIgnoreCase(String suffix)
NamedElement
for its name's suffix. The name's
capitalization is ignored.T
- The type of the matched object.suffix
- The expected name's suffix.public static <T extends NamedElement> ElementMatcher.Junction<T> nameContains(String infix)
NamedElement
for an infix of its name.T
- The type of the matched object.infix
- The expected infix of the name.public static <T extends NamedElement> ElementMatcher.Junction<T> nameContainsIgnoreCase(String infix)
NamedElement
for an infix of its name. The name's
capitalization is ignored.T
- The type of the matched object.infix
- The expected infix of the name.public static <T extends NamedElement> ElementMatcher.Junction<T> nameMatches(String regex)
NamedElement
name against a regular expression.T
- The type of the matched object.regex
- The regular expression to match the name against.public static <T extends NamedElement.WithOptionalName> ElementMatcher.Junction<T> isNamed()
NamedElement.WithOptionalName
for having an explicit name.T
- The type of the matched object.public static <T extends NamedElement.WithDescriptor> ElementMatcher.Junction<T> hasDescriptor(String descriptor)
NamedElement.WithDescriptor
's descriptor against a given value.T
- The type of the matched object.descriptor
- The expected descriptor.descriptor
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredBy(Class<?> type)
ByteCodeElement
for being declared by a given Class
. This matcher matches
a declared element's raw declaring type.T
- The type of the matched object.type
- The type that is expected to declare the matched byte code element.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredBy(TypeDescription type)
ByteCodeElement
for being declared by a given TypeDescription
. This matcher matches
a declared element's raw declaring type.T
- The type of the matched object.type
- The type that is expected to declare the matched byte code element.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredBy(ElementMatcher<? super TypeDescription> matcher)
ByteCodeElement
for being declared by a TypeDescription
that is matched by the given matcher. This matcher matches
a declared element's raw declaring type.T
- The type of the matched object.matcher
- A matcher for the declaring type of the matched byte code element as long as it
is not null
.matcher
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredByGeneric(Type type)
ByteCodeElement
for being declared by a given generic Type
.T
- The type of the matched object.type
- The type that is expected to declare the matched byte code element.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredByGeneric(TypeDescription.Generic type)
ByteCodeElement
for being declared by a given TypeDescription.Generic
.T
- The type of the matched object.type
- The type that is expected to declare the matched byte code element.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredByGeneric(ElementMatcher<? super TypeDescription.Generic> matcher)
ByteCodeElement
for being declared by a TypeDescription.Generic
that is matched by the given matcher.T
- The type of the matched object.matcher
- A matcher for the declaring type of the matched byte code element as long as it is not null
.matcher
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isVisibleTo(Class<?> type)
ByteCodeElement
that is visible to a given Class
.T
- The type of the matched object.type
- The type that a matched byte code element is expected to be visible to.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isVisibleTo(TypeDescription type)
ByteCodeElement
that is visible to a given TypeDescription
.T
- The type of the matched object.type
- The type that a matched byte code element is expected to be visible to.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isAccessibleTo(Class<?> type)
ByteCodeElement
that is accessible to a given Class
.T
- The type of the matched object.type
- The type that a matched byte code element is expected to be accessible to.type
.public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isAccessibleTo(TypeDescription type)
ByteCodeElement
that is accessible to a given Class
.T
- The type of the matched object.type
- The type that a matched byte code element is expected to be accessible to.type
.public static <T extends ModifierReviewable.OfAbstraction> ElementMatcher.Junction<T> isAbstract()
ModifierReviewable.OfAbstraction
that is abstract
.T
- The type of the matched object.abstract
modifier reviewable.public static <T extends ModifierReviewable.OfEnumeration> ElementMatcher.Junction<T> isEnum()
ModifierReviewable.OfEnumeration
that is an enum
or a field holding an enum.T
- The type of the matched object.public static <T extends AnnotationSource> ElementMatcher.Junction<T> isAnnotatedWith(Class<? extends Annotation> type)
AnnotationSource
for declared annotations.
This matcher does not match inherited annotations which only exist for classes. Use
inheritsAnnotation(Class)
for matching inherited annotations.T
- The type of the matched object.type
- The annotation type to match against.type
.public static <T extends AnnotationSource> ElementMatcher.Junction<T> isAnnotatedWith(TypeDescription type)
AnnotationSource
for declared annotations.
This matcher does not match inherited annotations which only exist for classes. Use
inheritsAnnotation(TypeDescription)
for matching inherited annotations.T
- The type of the matched object.type
- The annotation type to match against.type
.public static <T extends AnnotationSource> ElementMatcher.Junction<T> isAnnotatedWith(ElementMatcher<? super TypeDescription> matcher)
AnnotationSource
for declared annotations.
This matcher does not match inherited annotations which only exist for classes. Use
inheritsAnnotation(net.bytebuddy.matcher.ElementMatcher)
for matching inherited annotations.T
- The type of the matched object.matcher
- The matcher to apply to any annotation's type found on the matched annotated element.matcher
.public static <T extends AnnotationSource> ElementMatcher.Junction<T> declaresAnnotation(ElementMatcher<? super AnnotationDescription> matcher)
AnnotationSource
to declare any annotation
that matches the given matcher. Note that this matcher does not match inherited annotations that only exist
for types. Use inheritsAnnotation(net.bytebuddy.matcher.ElementMatcher)
for matching inherited annotations.T
- The type of the matched object.matcher
- A matcher to apply on any declared annotation of the matched annotated element.matcher
.public static <T extends ModifierReviewable.OfByteCodeElement> ElementMatcher.Junction<T> isPublic()
ModifierReviewable
that is public
.T
- The type of the matched object.public
modifier reviewable.public static <T extends ModifierReviewable.OfByteCodeElement> ElementMatcher.Junction<T> isProtected()
ModifierReviewable
that is protected
.T
- The type of the matched object.protected
modifier reviewable.public static <T extends ModifierReviewable.OfByteCodeElement> ElementMatcher.Junction<T> isPackagePrivate()
ModifierReviewable
that is package-private.T
- The type of the matched object.public static <T extends ModifierReviewable.OfByteCodeElement> ElementMatcher.Junction<T> isPrivate()
ModifierReviewable
that is private
.T
- The type of the matched object.private
modifier reviewable.public static <T extends ModifierReviewable.OfByteCodeElement> ElementMatcher.Junction<T> isStatic()
ModifierReviewable
that is static
.T
- The type of the matched object.static
modifier reviewable.public static <T extends ModifierReviewable> ElementMatcher.Junction<T> isFinal()
ModifierReviewable
that is final
.T
- The type of the matched object.final
modifier reviewable.public static <T extends ModifierReviewable> ElementMatcher.Junction<T> isSynthetic()
ModifierReviewable
that is synthetic.T
- The type of the matched object.public static <T extends ModifierReviewable.ForMethodDescription> ElementMatcher.Junction<T> isSynchronized()
MethodDescription
that is synchronized
.T
- The type of the matched object.synchronized
method description.public static <T extends ModifierReviewable.ForMethodDescription> ElementMatcher.Junction<T> isNative()
MethodDescription
that is native
.T
- The type of the matched object.native
method description.public static <T extends ModifierReviewable.ForMethodDescription> ElementMatcher.Junction<T> isStrict()
MethodDescription
that is strictfp
.T
- The type of the matched object.strictfp
method description.public static <T extends ModifierReviewable.ForMethodDescription> ElementMatcher.Junction<T> isVarArgs()
MethodDescription
that is a var-args.T
- The type of the matched object.public static <T extends ModifierReviewable.ForMethodDescription> ElementMatcher.Junction<T> isBridge()
MethodDescription
that is a bridge.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> returnsGeneric(Type type)
MethodDescription
s that return a given generic type.T
- The type of the matched object.type
- The generic type the matched method is expected to return.public static <T extends MethodDescription> ElementMatcher.Junction<T> returnsGeneric(TypeDescription.Generic type)
MethodDescription
s that returns a given
TypeDescription
.T
- The type of the matched object.type
- The type the matched method is expected to return.public static <T extends MethodDescription> ElementMatcher.Junction<T> returns(Class<?> type)
MethodDescription
s that return a given erasure type.T
- The type of the matched object.type
- The raw type the matched method is expected to return.public static <T extends MethodDescription> ElementMatcher.Junction<T> returns(TypeDescription type)
MethodDescription
s that return a given erasure type.T
- The type of the matched object.type
- The raw type the matched method is expected to return.public static <T extends MethodDescription> ElementMatcher.Junction<T> returns(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to a method's return type's erasure.public static <T extends MethodDescription> ElementMatcher.Junction<T> returnsGeneric(ElementMatcher<? super TypeDescription.Generic> matcher)
MethodDescription
s that match a matched method's return type.T
- The type of the matched object.matcher
- A matcher to apply onto a matched method's return type.matcher
.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArgument(int index, Type type)
MethodDescription
s that define a given generic type as a parameter at the given index.T
- The type of the matched object.index
- The index of the parameter.type
- The generic type the matched method is expected to define as a parameter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArgument(int index, TypeDescription.Generic type)
MethodDescription
s that define a given generic type as a parameter at the given index.T
- The type of the matched object.index
- The index of the parameter.type
- The generic type the matched method is expected to define as a parameter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArgument(int index, ElementMatcher<? super TypeDescription.Generic> matcher)
MethodDescription
s that define a given generic type as a parameter at the given index.T
- The type of the matched object.index
- The index of the parameter.matcher
- A matcher for the generic type the matched method is expected to define as a parameter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArguments(Type... type)
T
- The type of the matched object.type
- The arguments to match against the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArguments(TypeDefinition... type)
T
- The type of the matched object.type
- The arguments to match against the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArguments(List<? extends TypeDefinition> types)
T
- The type of the matched object.types
- The arguments to match against the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesGenericArguments(ElementMatcher<? super Iterable<? extends TypeDescription.Generic>> matchers)
MethodDescription
by applying an iterable collection of element matcher on any parameter's TypeDescription.Generic
.T
- The type of the matched object.matchers
- The matcher that are applied onto the parameter types of the matched method description.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, Class<?> type)
MethodDescription
s that define a given generic type as a parameter at the given index.T
- The type of the matched object.index
- The index of the parameter.type
- The erasure of the type the matched method is expected to define as a parameter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, TypeDescription type)
MethodDescription
s that define a given type erasure as a parameter at the given index.T
- The type of the matched object.index
- The index of the parameter.type
- The erasure of the type the matched method is expected to define as a parameter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, ElementMatcher<? super TypeDescription> matcher)
MethodDescription
s that define a type erasure as a parameter at the given index that matches the supplied matcher.T
- The type of the matched object.index
- The index of the parameter.matcher
- A matcher to apply to the argument at the specified index.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(Class<?>... type)
T
- The type of the matched object.type
- The arguments to match against the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(TypeDescription... type)
T
- The type of the matched object.type
- The arguments to match against the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(Iterable<? extends TypeDescription> types)
T
- The type of the matched object.types
- The arguments to match against the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(ElementMatcher<? super Iterable<? extends TypeDescription>> matchers)
MethodDescription
by applying an iterable collection of element matcher on any parameter's TypeDescription
.T
- The type of the matched object.matchers
- The matcher that are applied onto the parameter types of the matched method description.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(int length)
MethodDescription
by the number of its parameters.T
- The type of the matched object.length
- The expected length.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesNoArguments()
MethodDescription
with no parameters.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> hasParameters(ElementMatcher<? super Iterable<? extends ParameterDescription>> matcher)
MethodDescription
by validating that its parameters
fulfill a given constraint.T
- The type of the matched object.matcher
- The matcher to apply for validating the parameters.public static <T extends MethodDescription> ElementMatcher.Junction<T> canThrow(Class<? extends Throwable> exceptionType)
MethodDescription
by its capability to throw a given
checked exception. For specifying a non-checked exception, any method is matched.T
- The type of the matched object.exceptionType
- The type of the exception that should be declared by the method to be matched.public static <T extends MethodDescription> ElementMatcher.Junction<T> canThrow(TypeDescription exceptionType)
MethodDescription
by its capability to throw a given
checked exception. For specifying a non-checked exception, any method is matched.T
- The type of the matched object.exceptionType
- The type of the exception that should be declared by the method to be matched.public static <T extends MethodDescription> ElementMatcher.Junction<T> declaresGenericException(Type exceptionType)
declaresException(Class)
. For exceptions that are expressed as type variables, only exceptions
that are represented as this type variable are matched.T
- The type of the matched object.exceptionType
- The generic exception type that is matched exactly.public static <T extends MethodDescription> ElementMatcher.Junction<T> declaresGenericException(TypeDescription.Generic exceptionType)
declaresException(TypeDescription)
. For exceptions that are expressed as type variables, only exceptions
that are represented as this type variable are matched.T
- The type of the matched object.exceptionType
- The generic exception type that is matched exactly.public static <T extends MethodDescription> ElementMatcher.Junction<T> declaresException(Class<? extends Throwable> exceptionType)
T
- The type of the matched object.exceptionType
- The exception type that is matched.public static <T extends MethodDescription> ElementMatcher.Junction<T> declaresException(TypeDescription exceptionType)
T
- The type of the matched object.exceptionType
- The exception type that is matched.public static <T extends MethodDescription> ElementMatcher.Junction<T> declaresGenericException(ElementMatcher<? super Iterable<? extends TypeDescription.Generic>> matcher)
T
- The type of the matched object.matcher
- The exception matcher to apply onto the matched method's generic exceptions.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverriddenFrom(Class<?> type)
T
- The type of the matched object.type
- The super type of interest for which to check if it declares a method with the same signature as the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverriddenFrom(TypeDescription type)
T
- The type of the matched object.type
- The super type of interest for which to check if it declares a method with the same signature as the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverriddenFrom(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- A matcher for a method's declaring type that needs to be matched if that type declares a method with the same signature
as the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverriddenFromGeneric(Type type)
T
- The type of the matched object.type
- The super type of interest for which to check if it declares a method with the same signature as the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverriddenFromGeneric(TypeDescription.Generic type)
T
- The type of the matched object.type
- The super type of interest for which to check if it declares a method with the same signature as the matched method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverriddenFromGeneric(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- A matcher for a method's declaring type that needs to be matched if that type declares a method with the same signature
as the matched method.public static <T extends TypeDescription> ElementMatcher.Junction<T> isInterface()
TypeDescription
that is an interface. Annotation types are also considered interface types.T
- The type of the matched object.isAnnotation()
public static <T extends TypeDescription> ElementMatcher.Junction<T> isAnnotation()
TypeDescription
that is an annotation type.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isMethod()
Method
.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isConstructor()
Constructor
.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isTypeInitializer()
Class
type initializer.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isVirtual()
T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isDefaultMethod()
T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isDefaultConstructor()
T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isDefaultFinalizer()
Object.finalize()
method if it was not overridden.T
- The type of the matched object.Object.finalize()
method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isFinalizer()
Object.finalize()
method, even if it was overridden.T
- The type of the matched object.Object.finalize()
method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isHashCode()
Object.hashCode()
method, also if it was overridden.T
- The type of the matched object.Object.hashCode()
method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isEquals()
Object.equals(Object)
method, also if it was overridden.T
- The type of the matched object.Object.equals(Object)
method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isClone()
Object.clone()
method, also if it was overridden.T
- The type of the matched object.Object.clone()
method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isToString()
Object.toString()
method, also if it was overridden.T
- The type of the matched object.Object.toString()
method.public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter()
T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter(String property)
set
is matched despite that such a setter is not fulfilling the Java bean naming conventions.T
- The type of the matched object.property
- The property to match a setter for.public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter(Class<?> type)
T
- The type of the matched object.type
- The required setter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGenericSetter(Type type)
T
- The type of the matched object.type
- The required setter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter(TypeDescription type)
T
- The type of the matched object.type
- The required setter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGenericSetter(TypeDescription.Generic type)
T
- The type of the matched object.type
- The required setter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- A matcher to be allied to a setter method's argument type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGenericSetter(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- A matcher to be allied to a setter method's argument type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter()
T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter(String property)
get
is matched despite that such a getter is not fulfilling the Java bean naming conventions. If a getter's type is boolean
or Boolean
, is
is also accepted as a prefix.T
- The type of the matched object.property
- The property to match a getter for.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter(Class<?> type)
T
- The type of the matched object.type
- The required getter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGenericGetter(Type type)
T
- The type of the matched object.type
- The required getter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter(TypeDescription type)
T
- The type of the matched object.type
- The required getter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGenericGetter(TypeDescription.Generic type)
T
- The type of the matched object.type
- The required getter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- A matcher to be allied to a getter method's argument type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isGenericGetter(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- A matcher to be allied to a getter method's argument type.public static <T extends MethodDescription> ElementMatcher.Junction<T> hasMethodName(String internalName)
T
- The type of the matched object.internalName
- The internal name of the method.public static <T extends MethodDescription> ElementMatcher.Junction<T> hasSignature(MethodDescription.SignatureToken token)
T
- The type of the matched object.token
- The signature token to match against.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSubTypeOf(Class<?> type)
T
- The type of the matched object.type
- The type to be checked for being a subtype of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSubTypeOf(TypeDescription type)
T
- The type of the matched object.type
- The type to be checked for being a subtype of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSuperTypeOf(Class<?> type)
T
- The type of the matched object.type
- The type to be checked for being a subtype of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSuperTypeOf(TypeDescription type)
T
- The type of the matched object.type
- The type to be checked for being a subtype of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> hasSuperClass(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The type to be checked for being a super class of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> hasGenericSuperClass(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- The type to be checked for being a super class of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> hasSuperType(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The type to be checked for being a super type of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> hasGenericSuperType(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- The type to be checked for being a super type of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(Class<?> type)
T
- The type of the matched object.type
- The annotation type to be matched.public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(TypeDescription type)
T
- The type of the matched object.type
- The annotation type to be matched.public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- A matcher to apply onto the inherited annotations.public static <T extends TypeDescription> ElementMatcher.Junction<T> hasAnnotation(ElementMatcher<? super AnnotationDescription> matcher)
T
- The type of the matched object.matcher
- A matcher to apply onto a list of inherited annotations.public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresField(ElementMatcher<? super FieldDescription> matcher)
T
- The type of the matched object.matcher
- The matcher that is applied onto each declared field.public static <T extends TypeDefinition> ElementMatcher.Junction<T> declaresMethod(ElementMatcher<? super MethodDescription> matcher)
T
- The type of the matched object.matcher
- The matcher that is applied onto each declared method.public static <T extends TypeDefinition> ElementMatcher.Junction<T> ofSort(TypeDefinition.Sort sort)
T
- The type of the matched object.sort
- The generic type sort to match.public static <T extends TypeDefinition> ElementMatcher.Junction<T> ofSort(ElementMatcher<? super TypeDefinition.Sort> matcher)
T
- The type of the matched object.matcher
- A matcher for a generic type's sort.public static <T extends TypeDefinition> ElementMatcher.Junction<T> isPrimitive()
T
- The type of the matched object.public static <T extends TypeDefinition> ElementMatcher.Junction<T> isArray()
T
- The type of the matched object.public static <T extends TypeDefinition> ElementMatcher.Junction<T> isRecord()
T
- The type of the matched object.public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(Type fieldType)
T
- The type of the matched object.fieldType
- The field type to match.public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(TypeDescription.Generic fieldType)
T
- The type of the matched object.fieldType
- The field type to match.public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(ElementMatcher<? super TypeDescription.Generic> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to the field's type.public static <T extends FieldDescription> ElementMatcher.Junction<T> fieldType(Class<?> fieldType)
T
- The type of the matched object.fieldType
- The field type to match.public static <T extends FieldDescription> ElementMatcher.Junction<T> fieldType(TypeDescription fieldType)
T
- The type of the matched object.fieldType
- The field type to match.public static <T extends FieldDescription> ElementMatcher.Junction<T> fieldType(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to the field's type.public static <T extends FieldDescription> ElementMatcher.Junction<T> isVolatile()
volatile
field.T
- The type of the matched object.volatile
field.public static <T extends FieldDescription> ElementMatcher.Junction<T> isTransient()
transient
field.T
- The type of the matched object.transient
field.public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(Class<? extends Annotation> type)
T
- The type of the matched object.type
- The expected annotation type.public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(TypeDescription type)
T
- The type of the matched object.type
- The expected annotation type.public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The matcher to match the annotation's type against.public static <T extends AnnotationDescription> ElementMatcher.Junction<T> targetsElement(ElementType elementType)
T
- The type of the matched object.elementType
- The element type we target.public static <T extends ClassLoader> ElementMatcher.Junction<T> isBootstrapClassLoader()
ClassLoader
. The returned matcher is a synonym to
a matcher matching null
.T
- The type of the matched object.public static <T extends ClassLoader> ElementMatcher.Junction<T> isSystemClassLoader()
ClassLoader
. The returned matcher is a synonym to
a matcher matching ClassLoader.gerSystemClassLoader()
.T
- The type of the matched object.public static <T extends ClassLoader> ElementMatcher.Junction<T> isExtensionClassLoader()
ClassLoader
. The returned matcher is a synonym to
a matcher matching ClassLoader.gerSystemClassLoader().getParent()
.T
- The type of the matched object.public static <T extends ClassLoader> ElementMatcher.Junction<T> isChildOf(ClassLoader classLoader)
T
- The type of the matched object.classLoader
- The class loader of which child class loaders are matched.public static <T extends ClassLoader> ElementMatcher.Junction<T> hasChild(ElementMatcher<? super ClassLoader> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to all class loaders in the hierarchy of the matched class loader.public static <T extends ClassLoader> ElementMatcher.Junction<T> isParentOf(ClassLoader classLoader)
T
- The type of the matched object.classLoader
- The class loader of which parent class loaders are matched.public static <T extends ClassLoader> ElementMatcher.Junction<T> ofType(ElementMatcher<? super TypeDescription> matcher)
T
- The type of the matched object.matcher
- The matcher to apply to the class loader's type.public static <T extends JavaModule> ElementMatcher.Junction<T> supportsModules()
null
.T
- The type of the matched object.Copyright © 2014–2020. All rights reserved.