public final class ElementMatchers extends Object
ElementMatcher
s.Modifier and Type | Method and Description |
---|---|
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 TypeDescription> |
anyOf(Class<?>... value)
Creates a matcher that matches any of the given types as
TypeDescription 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> 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 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 AnnotatedElement> |
declaresAnnotation(ElementMatcher<? super AnnotationDescription> matcher)
Matches an
AnnotatedElement to declare any annotation
that matches the given matcher. |
static <T extends TypeDescription> |
declaresField(ElementMatcher<? super FieldDescription> fieldMatcher)
Matches a type by a another matcher that is applied on any of its declared fields.
|
static <T extends TypeDescription> |
declaresMethod(ElementMatcher<? super MethodDescription> methodMatcher)
Matches a type by a another matcher that is applied on any of its declared methods.
|
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 ByteCodeElement> |
hasDescriptor(String descriptor)
Matches a
ByteCodeElement 's descriptor against a given value. |
static <T extends MethodDescription> |
hasParameter(ElementMatcher<? super ParameterDescription> matcher)
Matches a
MethodDescription by validating that at least one
parameter fullfils a given constraint. |
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 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 typeDescription)
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 AnnotationDescription> |
is(AnnotationDescription annotationDescription)
Exactly matches a given
AnnotationDescription . |
static <T extends TypeDescription> |
is(Class<?> type)
Exactly matches a given type as a
TypeDescription . |
static <T extends MethodDescription> |
is(Constructor<?> constructor)
Exactly matches a given constructor as a
MethodDescription . |
static <T extends MethodDescription> |
is(Method method)
Exactly matches a given method as a
MethodDescription . |
static <T extends MethodDescription> |
is(MethodDescription methodDescription)
Exactly matches a given
MethodDescription . |
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 TypeDescription> |
is(TypeDescription typeDescription)
Exactly matches a given
TypeDescription . |
static <T extends AnnotatedElement> |
isAnnotatedWith(Class<? extends Annotation> type)
Matches an
AnnotatedElement for declared annotations. |
static <T extends AnnotatedElement> |
isAnnotatedWith(ElementMatcher<? super TypeDescription> matcher)
Matches an
AnnotatedElement for declared annotations. |
static <T extends AnnotatedElement> |
isAnnotatedWith(TypeDescription typeDescription)
Matches an
AnnotatedElement for declared annotations. |
static <T extends ClassLoader> |
isBootstrapClassLoader()
Matches exactly the bootstrap
ClassLoader . |
static <T extends MethodDescription> |
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 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 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> |
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(TypeDescription typeDescription)
Matches any Java bean getter method which returns the given type.
|
static <T extends MethodDescription> |
isHashCode()
Only matches the
Object.toString() method, also if it was overridden. |
static <T extends MethodDescription> |
isMethod()
Only matches method descriptions that represent a
Method . |
static <T extends MethodDescription> |
isNative()
Matches a
MethodDescription that is native . |
static <T extends MethodDescription> |
isOverridable()
Only matches methods that are overridable, i.e.
|
static <T extends ModifierReviewable> |
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 ModifierReviewable> |
isPrivate()
Matches a
ModifierReviewable that is private . |
static <T extends ModifierReviewable> |
isProtected()
Matches a
ModifierReviewable that is protected . |
static <T extends ModifierReviewable> |
isPublic()
Matches a
ModifierReviewable that is public . |
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(TypeDescription typeDescription)
Matches any Java bean setter method which takes an argument the given type.
|
static <T extends MethodDescription> |
isSpecializationOf(MethodDescription methodDescription)
Matches a specialized version of a given method.
|
static <T extends ModifierReviewable> |
isStatic()
Matches a
ModifierReviewable that is static . |
static <T extends MethodDescription> |
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 typeDescription)
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 typeDescription)
Matches any type description that is a super type of the given type.
|
static <T extends MethodDescription> |
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 MethodDescription> |
isTypeInitializer()
Only matches method descriptions that represent a
Class type initializer. |
static <T extends MethodDescription> |
isVarArgs()
Matches a
MethodDescription that is a var-args. |
static <T extends MethodDescription> |
isVisibilityBridge()
Only matches method descriptions that represent a visibility bridge.
|
static <T extends ByteCodeElement> |
isVisibleTo(Class<?> type)
Matches a
ByteCodeElement that is visible to a given Class . |
static <T extends ByteCodeElement> |
isVisibleTo(TypeDescription typeDescription)
Matches a
ByteCodeElement that is visible to a given
TypeDescription . |
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> |
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 TypeDescription> |
noneOf(Class<?>... value)
Creates a matcher that matches none of the given types as
TypeDescription 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> 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> ElementMatcher.Junction<T> |
not(ElementMatcher<? super T> matcher)
Inverts another matcher.
|
static <T extends MethodDescription> |
returns(Class<?> type)
Matches
MethodDescription s that returns a given
Class . |
static <T extends MethodDescription> |
returns(ElementMatcher<? super TypeDescription> matcher)
Matches
MethodDescription s that matches a matched method's
return type. |
static <T extends MethodDescription> |
returns(TypeDescription typeDescription)
Matches
MethodDescription s that returns a given
TypeDescription . |
static <T extends MethodDescription> |
takesArguments(Class<?>... type)
Matches a
MethodDescription by its exact parameter types. |
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> typeDescriptions)
Matches a
MethodDescription by its exact parameter types. |
static <T extends MethodDescription> |
takesArguments(TypeDescription... typeDescription)
Matches a
MethodDescription by its exact parameter types. |
static <T extends MethodDescription> |
throwing(ElementMatcher<? super List<? extends TypeDescription>> exceptionMatcher)
Matches a
MethodDescription by its declared exceptions. |
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 MethodDescription> ElementMatcher.Junction<T> is(Method method)
MethodDescription
.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
.T
- The type of the matched object.constructor
- The constructor to match by its descriptionpublic static <T extends MethodDescription> ElementMatcher.Junction<T> is(MethodDescription methodDescription)
MethodDescription
.T
- The type of the matched object.methodDescription
- The method description to match.public static <T extends TypeDescription> ElementMatcher.Junction<T> is(Class<?> type)
TypeDescription
.T
- The type of the matched object.type
- The type to match by its descriptionpublic static <T extends TypeDescription> ElementMatcher.Junction<T> is(TypeDescription typeDescription)
TypeDescription
.T
- The type of the matched object.typeDescription
- 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 extends AnnotationDescription> ElementMatcher.Junction<T> is(AnnotationDescription annotationDescription)
AnnotationDescription
.T
- The type of the matched object.annotationDescription
- The annotation description to match.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)
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> anyOf(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 TypeDescription> ElementMatcher.Junction<T> anyOf(Class<?>... 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 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 TypeDescription> ElementMatcher.Junction<T> noneOf(Class<?>... 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 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 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> 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 ByteCodeElement> ElementMatcher.Junction<T> hasDescriptor(String descriptor)
ByteCodeElement
'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(TypeDescription type)
ByteCodeElement
for being declared by a given
TypeDescription
.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(Class<?> type)
ByteCodeElement
for being declared by a given
Class
.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.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 typeDescription)
ByteCodeElement
that is visible to a given
TypeDescription
.T
- The type of the matched object.typeDescription
- The type that a matched byte code element is expected to be visible to.typeDescription
.public static <T extends AnnotatedElement> ElementMatcher.Junction<T> isAnnotatedWith(Class<? extends Annotation> type)
AnnotatedElement
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 AnnotatedElement> ElementMatcher.Junction<T> isAnnotatedWith(TypeDescription typeDescription)
AnnotatedElement
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.typeDescription
- The annotation type to match against.typeDescription
.public static <T extends AnnotatedElement> ElementMatcher.Junction<T> isAnnotatedWith(ElementMatcher<? super TypeDescription> matcher)
AnnotatedElement
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 AnnotatedElement> ElementMatcher.Junction<T> declaresAnnotation(ElementMatcher<? super AnnotationDescription> matcher)
AnnotatedElement
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> ElementMatcher.Junction<T> isPublic()
ModifierReviewable
that is public
.T
- The type of the matched object.public
modifier reviewable.public static <T extends ModifierReviewable> ElementMatcher.Junction<T> isProtected()
ModifierReviewable
that is protected
.T
- The type of the matched object.protected
modifier reviewable.public static <T extends ModifierReviewable> ElementMatcher.Junction<T> isPackagePrivate()
ModifierReviewable
that is package-private.T
- The type of the matched object.public static <T extends ModifierReviewable> ElementMatcher.Junction<T> isPrivate()
ModifierReviewable
that is private
.T
- The type of the matched object.private
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> isStatic()
ModifierReviewable
that is static
.T
- The type of the matched object.static
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 MethodDescription> ElementMatcher.Junction<T> isSynchronized()
MethodDescription
that is synchronized
.T
- The type of the matched object.synchronized
method description.public static <T extends MethodDescription> ElementMatcher.Junction<T> isNative()
MethodDescription
that is native
.T
- The type of the matched object.native
method description.public static <T extends MethodDescription> ElementMatcher.Junction<T> isStrict()
MethodDescription
that is strictfp
.T
- The type of the matched object.strictfp
method description.public static <T extends MethodDescription> ElementMatcher.Junction<T> isVarArgs()
MethodDescription
that is a var-args.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isBridge()
MethodDescription
that is a bridge.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> returns(Class<?> type)
MethodDescription
s that returns a given
Class
.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(TypeDescription typeDescription)
MethodDescription
s that returns a given
TypeDescription
.T
- The type of the matched object.typeDescription
- The type the matched method is expected to return.public static <T extends MethodDescription> ElementMatcher.Junction<T> returns(ElementMatcher<? super TypeDescription> matcher)
MethodDescription
s that matches 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> takesArguments(Class<?>... type)
MethodDescription
by its exact parameter types.T
- The type of the matched object.type
- The parameter types of a method in their order.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(TypeDescription... typeDescription)
MethodDescription
by its exact parameter types.T
- The type of the matched object.typeDescription
- The parameter types of a method in their order.public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArguments(Iterable<? extends TypeDescription> typeDescriptions)
MethodDescription
by its exact parameter types.T
- The type of the matched object.typeDescriptions
- The parameter types of a method in their order.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> hasParameter(ElementMatcher<? super ParameterDescription> matcher)
MethodDescription
by validating that at least one
parameter fullfils a given constraint.T
- The type of the matched object.matcher
- The constraint to check the parameters against.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> throwing(ElementMatcher<? super List<? extends TypeDescription>> exceptionMatcher)
MethodDescription
by its declared exceptions.T
- The type of the matched object.exceptionMatcher
- A matcher that is applied by to the declared exceptions.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> isVisibilityBridge()
public
method from a package-private type. In this case, the package-private type's method
is declared to be package-private itself such that the bridge method needs to increase the visibility and
delegates the call to the original, package-private implementation.T
- The type of the matched object.public static <T extends MethodDescription> ElementMatcher.Junction<T> isOverridable()
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.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> 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(Class<?> type)
T
- The type of the matched object.type
- The required setter type.public static <T extends MethodDescription> ElementMatcher.Junction<T> isSetter(TypeDescription typeDescription)
T
- The type of the matched object.typeDescription
- 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> isGetter()
T
- The type of the matched object.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> isGetter(TypeDescription typeDescription)
T
- The type of the matched object.typeDescription
- 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> isSpecializationOf(MethodDescription methodDescription)
T
- The type of the matched object.methodDescription
- The method description to match.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSubTypeOf(Class<?> type)
T
- The type of the matched object.type
- The type to be checked being a super type of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSubTypeOf(TypeDescription typeDescription)
T
- The type of the matched object.typeDescription
- The type to be checked being a super type 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 being a subtype of the matched type.public static <T extends TypeDescription> ElementMatcher.Junction<T> isSuperTypeOf(TypeDescription typeDescription)
T
- The type of the matched object.typeDescription
- The type to be checked being a subtype 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 typeDescription)
T
- The type of the matched object.typeDescription
- 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 TypeDescription> ElementMatcher.Junction<T> declaresField(ElementMatcher<? super FieldDescription> fieldMatcher)
T
- The type of the matched object.fieldMatcher
- The matcher that is applied onto each declared field.public static <T extends TypeDescription> ElementMatcher.Junction<T> declaresMethod(ElementMatcher<? super MethodDescription> methodMatcher)
T
- The type of the matched object.methodMatcher
- The matcher that is applied onto each declared method.public static <T extends ClassLoader> ElementMatcher<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<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<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<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<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<T> isParentOf(ClassLoader classLoader)
T
- The type of the matched object.classLoader
- The class loader of which parent class loaders are matched.Copyright © 2014–2015. All rights reserved.