Package net.bytebuddy.matcher
Class BooleanMatcher<T>
- java.lang.Object
-
- net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase<T>
-
- net.bytebuddy.matcher.BooleanMatcher<T>
-
- Type Parameters:
T
- The actual matched type of this matcher.
- All Implemented Interfaces:
ElementMatcher<T>
,ElementMatcher.Junction<T>
@Enhance public class BooleanMatcher<T> extends ElementMatcher.Junction.AbstractBase<T>
An element matcher that returns a fixed result.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher
ElementMatcher.Junction<S>
-
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher.Junction
ElementMatcher.Junction.AbstractBase<V>, ElementMatcher.Junction.Conjunction<W>, ElementMatcher.Junction.Disjunction<W>
-
-
Field Summary
Fields Modifier and Type Field Description private static BooleanMatcher<?>
FALSE
A matcher that always returnsfalse
.private boolean
matches
The predefined result.private static BooleanMatcher<?>
TRUE
A matcher that always returnstrue
.
-
Constructor Summary
Constructors Constructor Description BooleanMatcher(boolean matches)
Creates a new boolean element matcher.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
matches(T target)
Matches a target against this element matcher.static <T> ElementMatcher.Junction<T>
of(boolean matches)
Returns an element matcher that returns the provided result.java.lang.String
toString()
-
Methods inherited from class net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase
and, or
-
-
-
-
Field Detail
-
TRUE
private static final BooleanMatcher<?> TRUE
A matcher that always returnstrue
.
-
FALSE
private static final BooleanMatcher<?> FALSE
A matcher that always returnsfalse
.
-
matches
private final boolean matches
The predefined result.
-
-
Method Detail
-
of
public static <T> ElementMatcher.Junction<T> of(boolean matches)
Returns an element matcher that returns the provided result.- Type Parameters:
T
- The type of the matched entity.- Parameters:
matches
- A matcher that always matches or never matches.- Returns:
- A matcher that returns the provided result for all inputs.
-
matches
public boolean matches(T target)
Matches a target against this element matcher.- Parameters:
target
- The instance to be matched.- Returns:
true
if the given element is matched by this matcher orfalse
otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-