Package net.bytebuddy.matcher
Class CollectionElementMatcher<T>
- java.lang.Object
-
- net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase<java.lang.Iterable<? extends T>>
-
- net.bytebuddy.matcher.CollectionElementMatcher<T>
-
- Type Parameters:
T
- The type of the elements contained by the collection.
- All Implemented Interfaces:
ElementMatcher<java.lang.Iterable<? extends T>>
,ElementMatcher.Junction<java.lang.Iterable<? extends T>>
@Enhance public class CollectionElementMatcher<T> extends ElementMatcher.Junction.AbstractBase<java.lang.Iterable<? extends T>>
A matcher that matches a given element of a collection. If no such element is contained by the matched iterable, the matcher returnsfalse
.
-
-
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 int
index
The index of the matched element.private ElementMatcher<? super T>
matcher
The matcher for the given element, if it exists.
-
Constructor Summary
Constructors Constructor Description CollectionElementMatcher(int index, ElementMatcher<? super T> matcher)
Creates a new matcher for an element in a collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
matches(java.lang.Iterable<? extends T> target)
Matches a target against this element matcher.java.lang.String
toString()
-
Methods inherited from class net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase
and, or
-
-
-
-
Field Detail
-
index
private final int index
The index of the matched element.
-
matcher
private final ElementMatcher<? super T> matcher
The matcher for the given element, if it exists.
-
-
Constructor Detail
-
CollectionElementMatcher
public CollectionElementMatcher(int index, ElementMatcher<? super T> matcher)
Creates a new matcher for an element in a collection.- Parameters:
index
- The index of the matched element.matcher
- The matcher for the given element, if it exists.
-
-
Method Detail
-
matches
public boolean matches(java.lang.Iterable<? extends 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
-
-