Top Description Inners Methods
net.bytebuddy.matcher

public Interface ElementMatcher<T>

Known Direct Subinterfaces
net.bytebuddy.matcher.ElementMatcher.Junction, net.bytebuddy.build.Plugin
Known Direct Implementers
net.bytebuddy.asm.AsmVisitorWrapper.ForDeclaredFields.Entry, net.bytebuddy.asm.AsmVisitorWrapper.ForDeclaredMethods.Entry, net.bytebuddy.asm.ModifierAdjustment.Adjustment, net.bytebuddy.dynamic.scaffold.FieldRegistry.Default.Compiled.Entry, net.bytebuddy.dynamic.scaffold.RecordComponentRegistry.Default.Compiled.Entry
Type Parameters
<T>
The type of the object that is being matched.
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.utility.nullability.MaybeNull, .UnknownNull, java.util.ArrayList, .Arrays, .List

An element matcher is used as a predicate for identifying code elements such as types, methods, fields or annotations. They are similar to Java 8's Predicates but compatible to Java 6 and Java 7 and represent a functional interface. They can be chained by using instances of net.bytebuddy.matcher.ElementMatcher.Junction.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ElementMatcher.Junction<
The type of the object that is being matched.
S
>

A junctions allows to chain different net.bytebuddy.matcher.ElementMatchers in a readable manner.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the given element is matched by this matcher or false otherwise.
matches
(T
The instance to be matched or null.
target
)

Matches a target against this element matcher.

Method Detail

matchesback to summary
public boolean matches(T target)

Matches a target against this element matcher.

Parameters
target:T

The instance to be matched or null.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.

net.bytebuddy.matcher back to summary

public Interface ElementMatcher.Junction<S>

extends ElementMatcher<S>
Known Direct Implementers
net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase
Type Parameters
<S>
The type of the object that is being matched.

A junctions allows to chain different net.bytebuddy.matcher.ElementMatchers in a readable manner.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
ElementMatcher.Junction.AbstractBase<
The type of the object that is being matched.
V
>

A base implementation of net.bytebuddy.matcher.ElementMatcher.Junction.

public static class
ElementMatcher.Junction.Conjunction<
The type of the object that is being matched.
W
>

A conjunction matcher which only matches an element if both represented matchers constitute a match.

public static class
ElementMatcher.Junction.Disjunction<
The type of the object that is being matched.
W
>

A disjunction matcher which matches an element against matchers in order to constitute a successful match.

public abstract static class
ElementMatcher.Junction.ForNonNullValues<
The type of the object that is being matched.
W
>

An abstract base implementation that rejects null values.

Method Summary

Modifier and TypeMethod and Description
public <
The type of the object that is being matched. Note that Java's type inference might not be able to infer the common subtype of this instance and the other matcher such that this type must need to be named explicitly.
U extends S
>
ElementMatcher.Junction<U>

Returns:

A conjunction of this matcher and the other matcher.
and
(ElementMatcher<? super U>
The second matcher to consult.
other
)

Creates a conjunction where this matcher and the other matcher must both be matched in order to constitute a successful match.

public <
The type of the object that is being matched. Note that Java's type inference might not be able to infer the common subtype of this instance and the other matcher such that this type must need to be named explicitly.
U extends S
>
ElementMatcher.Junction<U>

Returns:

A disjunction of this matcher and the other matcher.
or
(ElementMatcher<? super U>
The second matcher to consult.
other
)

Creates a disjunction where either this matcher or the other matcher must be matched in order to constitute a successful match.

Inherited from net.bytebuddy.matcher.ElementMatcher:
matches

Method Detail

andback to summary
public <U extends S> ElementMatcher.Junction<U> and(ElementMatcher<? super U> other)

Creates a conjunction where this matcher and the other matcher must both be matched in order to constitute a successful match. The other matcher is only invoked if this matcher constitutes a successful match.

Parameters
<U>
The type of the object that is being matched. Note that Java's type inference might not be able to infer the common subtype of this instance and the other matcher such that this type must need to be named explicitly.
other:ElementMatcher<? super U>

The second matcher to consult.

Returns:ElementMatcher.Junction<U>

A conjunction of this matcher and the other matcher.

orback to summary
public <U extends S> ElementMatcher.Junction<U> or(ElementMatcher<? super U> other)

Creates a disjunction where either this matcher or the other matcher must be matched in order to constitute a successful match. The other matcher is only invoked if this matcher constitutes an unsuccessful match.

Parameters
<U>
The type of the object that is being matched. Note that Java's type inference might not be able to infer the common subtype of this instance and the other matcher such that this type must need to be named explicitly.
other:ElementMatcher<? super U>

The second matcher to consult.

Returns:ElementMatcher.Junction<U>

A disjunction of this matcher and the other matcher.

net.bytebuddy.matcher back to summary

public abstract Class ElementMatcher.Junction.AbstractBase<V>

extends Object
implements ElementMatcher.Junction<V>
Class Inheritance
All Implemented Interfaces
net.bytebuddy.matcher.ElementMatcher.Junction, net.bytebuddy.matcher.ElementMatcher
Known Direct Subclasses
net.bytebuddy.matcher.ElementMatcher.Junction.Conjunction, net.bytebuddy.matcher.ElementMatcher.Junction.Disjunction, net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues, net.bytebuddy.matcher.EqualityMatcher, net.bytebuddy.matcher.FailSafeMatcher, net.bytebuddy.matcher.NegatingMatcher, net.bytebuddy.matcher.NullMatcher, net.bytebuddy.matcher.BooleanMatcher, net.bytebuddy.matcher.CachingMatcher, net.bytebuddy.matcher.ClassLoaderHierarchyMatcher, net.bytebuddy.matcher.ClassLoaderParentMatcher
Type Parameters
<V>
The type of the object that is being matched.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <U extends V> ElementMatcher.Junction<U>
and(ElementMatcher<? super U>
The second matcher to consult.
other
)

Implements net.bytebuddy.matcher.ElementMatcher.Junction.and.

Creates a conjunction where this matcher and the other matcher must both be matched in order to constitute a successful match.
public <U extends V> ElementMatcher.Junction<U>
or(ElementMatcher<? super U>
The second matcher to consult.
other
)

Implements net.bytebuddy.matcher.ElementMatcher.Junction.or.

Creates a disjunction where either this matcher or the other matcher must be matched in order to constitute a successful match.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractBaseback to summary
public AbstractBase()

Method Detail

andback to summary
public <U extends V> ElementMatcher.Junction<U> and(ElementMatcher<? super U> other)

Implements net.bytebuddy.matcher.ElementMatcher.Junction.and.

Doc from net.bytebuddy.matcher.ElementMatcher.Junction.and.

Creates a conjunction where this matcher and the other matcher must both be matched in order to constitute a successful match. The other matcher is only invoked if this matcher constitutes a successful match.

Parameters
<U>
The type of the object that is being matched. Note that Java's type inference might not be able to infer the common subtype of this instance and the other matcher such that this type must need to be named explicitly.
other:ElementMatcher<? super U>

The second matcher to consult.

Returns:ElementMatcher.Junction<U>

A conjunction of this matcher and the other matcher.

Annotations
@SuppressWarnings:unchecked
orback to summary
public <U extends V> ElementMatcher.Junction<U> or(ElementMatcher<? super U> other)

Implements net.bytebuddy.matcher.ElementMatcher.Junction.or.

Doc from net.bytebuddy.matcher.ElementMatcher.Junction.or.

Creates a disjunction where either this matcher or the other matcher must be matched in order to constitute a successful match. The other matcher is only invoked if this matcher constitutes an unsuccessful match.

Parameters
<U>
The type of the object that is being matched. Note that Java's type inference might not be able to infer the common subtype of this instance and the other matcher such that this type must need to be named explicitly.
other:ElementMatcher<? super U>

The second matcher to consult.

Returns:ElementMatcher.Junction<U>

A disjunction of this matcher and the other matcher.

Annotations
@SuppressWarnings:unchecked
net.bytebuddy.matcher back to summary

public Class ElementMatcher.Junction.Conjunction<W>

extends ElementMatcher.Junction.AbstractBase<W>
Class Inheritance
Annotations
@Enhance
Type Parameters
<W>
The type of the object that is being matched.

A conjunction matcher which only matches an element if both represented matchers constitute a match.

Field Summary

Modifier and TypeField and Description
private final List<ElementMatcher<? super W>>
matchers

The element matchers that constitute this conjunction.

Constructor Summary

AccessConstructor and Description
public
Conjunction(ElementMatcher<? super W>...
The represented matchers in application order.
matcher
)

Creates a new conjunction matcher.

public
Conjunction(List<ElementMatcher<? super W>>
The represented matchers in application order.
matchers
)

Creates a new conjunction matcher.

Method Summary

Modifier and TypeMethod and Description
public boolean
matches(W
The instance to be matched or null.
target
)

Implements net.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase:
andor

Field Detail

matchersback to summary
private final List<ElementMatcher<? super W>> matchers

The element matchers that constitute this conjunction.

Constructor Detail

Conjunctionback to summary
public Conjunction(ElementMatcher<? super W>... matcher)

Creates a new conjunction matcher.

Parameters
matcher:ElementMatcher<? super W>[]

The represented matchers in application order.

Annotations
@SuppressWarnings:unchecked
Conjunctionback to summary
public Conjunction(List<ElementMatcher<? super W>> matchers)

Creates a new conjunction matcher.

Parameters
matchers:List<ElementMatcher<? super W>>

The represented matchers in application order.

Annotations
@SuppressWarnings:unchecked

Method Detail

matchesback to summary
public boolean matches(W target)

Implements net.bytebuddy.matcher.ElementMatcher.matches.

Doc from net.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.

Parameters
target:W

The instance to be matched or null.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
net.bytebuddy.matcher back to summary

public Class ElementMatcher.Junction.Disjunction<W>

extends ElementMatcher.Junction.AbstractBase<W>
Class Inheritance
Annotations
@Enhance
Type Parameters
<W>
The type of the object that is being matched.

A disjunction matcher which matches an element against matchers in order to constitute a successful match.

Field Summary

Modifier and TypeField and Description
private final List<ElementMatcher<? super W>>
matchers

The element matchers that constitute this disjunction.

Constructor Summary

AccessConstructor and Description
public
Disjunction(ElementMatcher<? super W>...
The represented matchers in application order.
matcher
)

Creates a new disjunction matcher.

public
Disjunction(List<ElementMatcher<? super W>>
The represented matchers in application order.
matchers
)

Creates a new disjunction matcher.

Method Summary

Modifier and TypeMethod and Description
public boolean
matches(W
The instance to be matched or null.
target
)

Implements net.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase:
andor

Field Detail

matchersback to summary
private final List<ElementMatcher<? super W>> matchers

The element matchers that constitute this disjunction.

Constructor Detail

Disjunctionback to summary
public Disjunction(ElementMatcher<? super W>... matcher)

Creates a new disjunction matcher.

Parameters
matcher:ElementMatcher<? super W>[]

The represented matchers in application order.

Annotations
@SuppressWarnings:unchecked
Disjunctionback to summary
public Disjunction(List<ElementMatcher<? super W>> matchers)

Creates a new disjunction matcher.

Parameters
matchers:List<ElementMatcher<? super W>>

The represented matchers in application order.

Annotations
@SuppressWarnings:unchecked

Method Detail

matchesback to summary
public boolean matches(W target)

Implements net.bytebuddy.matcher.ElementMatcher.matches.

Doc from net.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.

Parameters
target:W

The instance to be matched or null.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
net.bytebuddy.matcher back to summary

public abstract Class ElementMatcher.Junction.ForNonNullValues<W>

extends ElementMatcher.Junction.AbstractBase<W>
Class Inheritance
Known Direct Subclasses
net.bytebuddy.matcher.ErasureMatcher, net.bytebuddy.matcher.FieldTypeMatcher, net.bytebuddy.matcher.HasSuperClassMatcher, net.bytebuddy.matcher.HasSuperTypeMatcher, net.bytebuddy.matcher.InheritedAnnotationMatcher, net.bytebuddy.matcher.IsNamedMatcher, net.bytebuddy.matcher.LatentMatcher.ForFieldToken.ResolvedMatcher, net.bytebuddy.matcher.LatentMatcher.ForMethodToken.ResolvedMatcher, net.bytebuddy.matcher.MethodExceptionTypeMatcher, net.bytebuddy.matcher.MethodOverrideMatcher, net.bytebuddy.matcher.MethodParametersMatcher, net.bytebuddy.matcher.MethodParameterTypeMatcher, net.bytebuddy.matcher.MethodParameterTypesMatcher, net.bytebuddy.matcher.MethodReturnTypeMatcher, net.bytebuddy.matcher.MethodSortMatcher, net.bytebuddy.matcher.ModifierMatcher, net.bytebuddy.matcher.NameMatcher, net.bytebuddy.matcher.PrimitiveTypeMatcher, net.bytebuddy.matcher.RecordMatcher, net.bytebuddy.matcher.SignatureTokenMatcher, net.bytebuddy.matcher.StringMatcher, net.bytebuddy.matcher.StringSetMatcher, net.bytebuddy.matcher.SubTypeMatcher, net.bytebuddy.matcher.SuperTypeMatcher, net.bytebuddy.matcher.TypeSortMatcher, net.bytebuddy.matcher.VisibilityMatcher, net.bytebuddy.build.HashCodeAndEqualsPlugin.ValueMatcher, net.bytebuddy.matcher.DeclaringAnnotationMatcher, net.bytebuddy.matcher.InstanceTypeMatcher, net.bytebuddy.matcher.AccessibilityMatcher, net.bytebuddy.matcher.AnnotationTargetMatcher, net.bytebuddy.matcher.AnnotationTypeMatcher, net.bytebuddy.matcher.ArrayTypeMatcher, net.bytebuddy.matcher.ClassFileVersionMatcher, net.bytebuddy.matcher.CollectionElementMatcher, net.bytebuddy.matcher.CollectionErasureMatcher, net.bytebuddy.matcher.CollectionItemMatcher, net.bytebuddy.matcher.CollectionOneToOneMatcher, net.bytebuddy.matcher.CollectionSizeMatcher, net.bytebuddy.matcher.DeclaringFieldMatcher, net.bytebuddy.matcher.DeclaringMethodMatcher, net.bytebuddy.matcher.DeclaringTypeMatcher, net.bytebuddy.matcher.DefinedShapeMatcher, net.bytebuddy.matcher.DescriptorMatcher
Annotations
@Enhance
Type Parameters
<W>
The type of the object that is being matched.

An abstract base implementation that rejects null values.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract boolean

Returns:

true if the given element is matched by this matcher or false otherwise.
doMatch
(W
The instance to be matched.
target
)

Matches the supplied value if it was found not to be null.

public boolean
matches(W
The instance to be matched or null.
target
)

Implements net.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.
Inherited from net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase:
andor

Constructor Detail

ForNonNullValuesback to summary
public ForNonNullValues()

Method Detail

doMatchback to summary
protected abstract boolean doMatch(W target)

Matches the supplied value if it was found not to be null.

Parameters
target:W

The instance to be matched.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.

matchesback to summary
public boolean matches(W target)

Implements net.bytebuddy.matcher.ElementMatcher.matches.

Doc from net.bytebuddy.matcher.ElementMatcher.matches.

Matches a target against this element matcher.

Parameters
target:W

The instance to be matched or null.

Returns:boolean

true if the given element is matched by this matcher or false otherwise.