// Generated by delombok at Sun Feb 26 12:31:38 KST 2017 package scouter.bytebuddy.matcher; /** * An element matcher that matches all {@link java.lang.ClassLoader}s in the matched class loaders hierarchy * against a given matcher. * * @param <T> The exact type of the class loader that is matched. */ public class ClassLoaderHierarchyMatcher<T extends ClassLoader> extends ElementMatcher.Junction.AbstractBase<T> { /** * The matcher to apply on each class loader in the hierarchy. */ private final ElementMatcher<? super ClassLoader> matcher; /** * Creates a new class loader hierarchy matcher. * * @param matcher The matcher to apply on each class loader in the hierarchy. */ public ClassLoaderHierarchyMatcher(ElementMatcher<? super ClassLoader> matcher) { this.matcher = matcher; } @Override public boolean matches(T target) { ClassLoader current = target; while (current != null) { if (matcher.matches(current)) { return true; } current = current.getParent(); } return matcher.matches(null); } @Override public String toString() { return "hasChild(" + 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 ClassLoaderHierarchyMatcher)) return false; final ClassLoaderHierarchyMatcher<?> other = (ClassLoaderHierarchyMatcher<?>) 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 ClassLoaderHierarchyMatcher; } @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; } }