// Generated by delombok at Sun Feb 26 12:31:38 KST 2017
package scouter.bytebuddy.matcher;
/**
* A list item matcher matches any element of a collection to a given matcher and assures that at least one
* element matches the supplied iterable condition.
*
* @param <T> The type of the matched entity.
*/
public class CollectionItemMatcher<T> extends ElementMatcher.Junction.AbstractBase<Iterable<? extends T>> {
/**
* The element matcher to apply to each element of a collection.
*/
private final ElementMatcher<? super T> matcher;
/**
* Creates a new matcher that applies another matcher to each element of a matched iterable collection.
*
* @param matcher The element matcher to apply to each element of a iterable collection.
*/
public CollectionItemMatcher(ElementMatcher<? super T> matcher) {
this.matcher = matcher;
}
@Override
public boolean matches(Iterable<? extends T> target) {
for (T value : target) {
if (matcher.matches(value)) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "whereOne(" + matcher + ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof CollectionItemMatcher)) return false;
final CollectionItemMatcher<?> other = (CollectionItemMatcher<?>) o;
if (!other.canEqual((java.lang.Object) this)) return false;
final java.lang.Object this$matcher = this.matcher;
final java.lang.Object other$matcher = other.matcher;
if (this$matcher == null ? other$matcher != null : !this$matcher.equals(other$matcher)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof CollectionItemMatcher;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final java.lang.Object $matcher = this.matcher;
result = result * PRIME + ($matcher == null ? 43 : $matcher.hashCode());
return result;
}
}