// Generated by delombok at Sun Feb 26 12:31:38 KST 2017 package scouter.bytebuddy.matcher; import scouter.bytebuddy.description.field.FieldDescription; import scouter.bytebuddy.description.method.MethodDescription; import scouter.bytebuddy.description.type.TypeDescription; import java.util.Arrays; import java.util.List; /** * A latent matcher that resolves an {@link ElementMatcher} after supplying a type description. * * @param <T> The type of the matched element. */ public interface LatentMatcher<T> { /** * Resolves the element matcher this instance represents for the supplied type description. * * @param typeDescription The type description for which the represented matcher should be resolved. * @return An {@link ElementMatcher} that represents this matcher's resolved form. */ ElementMatcher<? super T> resolve(TypeDescription typeDescription); /** * A latent matching methods that are declared by the resolved type. */ enum ForSelfDeclaredMethod implements LatentMatcher<MethodDescription> { /** * Matches any method declared by the resolved type. */ DECLARED(false), /** * Matches any method not declared by the resolved type. */ NOT_DECLARED(true); /** * {@code true} if the matcher is inverted. */ private final boolean inverted; /** * Creates a new latent matcher for a self-declared method. * * @param inverted {@code true} if the matcher is inverted. */ ForSelfDeclaredMethod(boolean inverted) { this.inverted = inverted; } @Override @SuppressWarnings("unchecked") public ElementMatcher<? super MethodDescription> resolve(TypeDescription typeDescription) { // Casting is required by some Java 6 compilers. return (ElementMatcher<? super MethodDescription>) (inverted ? ElementMatchers.not(ElementMatchers.isDeclaredBy(typeDescription)) : ElementMatchers.isDeclaredBy(typeDescription)); } } /** * A latent matcher representing an already resolved {@link ElementMatcher}. * * @param <S> The type of the matched element. */ class Resolved<S> implements LatentMatcher<S> { /** * The resolved matcher. */ private final ElementMatcher<? super S> matcher; /** * Creates a new resolved latent matcher. * * @param matcher The resolved matcher. */ public Resolved(ElementMatcher<? super S> matcher) { this.matcher = matcher; } @Override public ElementMatcher<? super S> resolve(TypeDescription typeDescription) { return 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 LatentMatcher.Resolved)) return false; final LatentMatcher.Resolved<?> other = (LatentMatcher.Resolved<?>) 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 LatentMatcher.Resolved; } @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; } } /** * A latent matcher where the field token is being attached to the supplied type description before matching. */ class ForFieldToken implements LatentMatcher<FieldDescription> { /** * A token representing the field being matched. */ private final FieldDescription.Token token; /** * Creates a new latent matcher for a field token. * * @param token A token representing the field being matched. */ public ForFieldToken(FieldDescription.Token token) { this.token = token; } @Override public ElementMatcher<? super FieldDescription> resolve(TypeDescription typeDescription) { return new ResolvedMatcher(token.asSignatureToken(typeDescription)); } /** * A resolved matcher of a latent field matcher for a field token. */ protected static class ResolvedMatcher implements ElementMatcher<FieldDescription> { /** * The signature token representing the matched field. */ private final FieldDescription.SignatureToken signatureToken; /** * Creates a new resolved matcher. * * @param signatureToken The signature token representing the matched field. */ protected ResolvedMatcher(FieldDescription.SignatureToken signatureToken) { this.signatureToken = signatureToken; } @Override public boolean matches(FieldDescription target) { return target.asSignatureToken().equals(signatureToken); } @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 LatentMatcher.ForFieldToken.ResolvedMatcher)) return false; final LatentMatcher.ForFieldToken.ResolvedMatcher other = (LatentMatcher.ForFieldToken.ResolvedMatcher) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$signatureToken = this.signatureToken; final java.lang.Object other$signatureToken = other.signatureToken; if (this$signatureToken == null ? other$signatureToken != null : !this$signatureToken.equals(other$signatureToken)) return false; return true; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") protected boolean canEqual(final java.lang.Object other) { return other instanceof LatentMatcher.ForFieldToken.ResolvedMatcher; } @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 $signatureToken = this.signatureToken; result = result * PRIME + ($signatureToken == null ? 43 : $signatureToken.hashCode()); return result; } } @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 LatentMatcher.ForFieldToken)) return false; final LatentMatcher.ForFieldToken other = (LatentMatcher.ForFieldToken) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$token = this.token; final java.lang.Object other$token = other.token; if (this$token == null ? other$token != null : !this$token.equals(other$token)) return false; return true; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") protected boolean canEqual(final java.lang.Object other) { return other instanceof LatentMatcher.ForFieldToken; } @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 $token = this.token; result = result * PRIME + ($token == null ? 43 : $token.hashCode()); return result; } } /** * A latent matcher where the method token is being attached to the supplied type description before matching. */ class ForMethodToken implements LatentMatcher<MethodDescription> { /** * A token representing the method being matched. */ private final MethodDescription.Token token; /** * Creates a new latent matcher for a method token. * * @param token A token representing the method being matched. */ public ForMethodToken(MethodDescription.Token token) { this.token = token; } @Override public ElementMatcher<? super MethodDescription> resolve(TypeDescription typeDescription) { return new ResolvedMatcher(token.asSignatureToken(typeDescription)); } /** * A resolved matcher of a latent method matcher for a method token. */ protected static class ResolvedMatcher implements ElementMatcher<MethodDescription> { /** * The signature token representing the matched field. */ private final MethodDescription.SignatureToken signatureToken; /** * Creates a new resolved matcher. * * @param signatureToken The signature token representing the matched field. */ protected ResolvedMatcher(MethodDescription.SignatureToken signatureToken) { this.signatureToken = signatureToken; } @Override public boolean matches(MethodDescription target) { return target.asSignatureToken().equals(signatureToken); } @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 LatentMatcher.ForMethodToken.ResolvedMatcher)) return false; final LatentMatcher.ForMethodToken.ResolvedMatcher other = (LatentMatcher.ForMethodToken.ResolvedMatcher) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$signatureToken = this.signatureToken; final java.lang.Object other$signatureToken = other.signatureToken; if (this$signatureToken == null ? other$signatureToken != null : !this$signatureToken.equals(other$signatureToken)) return false; return true; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") protected boolean canEqual(final java.lang.Object other) { return other instanceof LatentMatcher.ForMethodToken.ResolvedMatcher; } @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 $signatureToken = this.signatureToken; result = result * PRIME + ($signatureToken == null ? 43 : $signatureToken.hashCode()); return result; } } @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 LatentMatcher.ForMethodToken)) return false; final LatentMatcher.ForMethodToken other = (LatentMatcher.ForMethodToken) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$token = this.token; final java.lang.Object other$token = other.token; if (this$token == null ? other$token != null : !this$token.equals(other$token)) return false; return true; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") protected boolean canEqual(final java.lang.Object other) { return other instanceof LatentMatcher.ForMethodToken; } @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 $token = this.token; result = result * PRIME + ($token == null ? 43 : $token.hashCode()); return result; } } /** * A matcher that computes the conjunction of all supplied latent matchers. * * @param <S> The type of the matched element. */ class Conjunction<S> implements LatentMatcher<S> { /** * The matchers this conjunction represents. */ private final List<? extends LatentMatcher<? super S>> matchers; // In absence of @SafeVarargs for Java 6 /** * Creates a new conjunction of latent matchers. * * @param matcher The matchers this conjunction represents. */ @SuppressWarnings("unchecked") public Conjunction(LatentMatcher<? super S>... matcher) { this(Arrays.asList(matcher)); } /** * Creates a new conjunction of latent matchers. * * @param matchers The matchers this conjunction represents. */ public Conjunction(List<? extends LatentMatcher<? super S>> matchers) { this.matchers = matchers; } @Override public ElementMatcher<? super S> resolve(TypeDescription typeDescription) { ElementMatcher.Junction<S> matcher = ElementMatchers.any(); for (LatentMatcher<? super S> latentMatcher : matchers) { matcher = matcher.and(latentMatcher.resolve(typeDescription)); } return 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 LatentMatcher.Conjunction)) return false; final LatentMatcher.Conjunction<?> other = (LatentMatcher.Conjunction<?>) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$matchers = this.matchers; final java.lang.Object other$matchers = other.matchers; if (this$matchers == null ? other$matchers != null : !this$matchers.equals(other$matchers)) return false; return true; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") protected boolean canEqual(final java.lang.Object other) { return other instanceof LatentMatcher.Conjunction; } @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 $matchers = this.matchers; result = result * PRIME + ($matchers == null ? 43 : $matchers.hashCode()); return result; } } /** * A matcher that computes the disjunction of all supplied latent matchers. * * @param <S> The type of the matched element. */ class Disjunction<S> implements LatentMatcher<S> { /** * The matchers this disjunction represents. */ private final List<? extends LatentMatcher<? super S>> matchers; /** * Creates a new disjunction of latent matchers. * * @param matcher The matchers this disjunction represents. */ // In absence of @SafeVarargs for Java 6 @SuppressWarnings("unchecked") public Disjunction(LatentMatcher<? super S>... matcher) { this(Arrays.asList(matcher)); } /** * Creates a new disjunction of latent matchers. * * @param matchers The matchers this disjunction represents. */ public Disjunction(List<? extends LatentMatcher<? super S>> matchers) { this.matchers = matchers; } @Override public ElementMatcher<? super S> resolve(TypeDescription typeDescription) { ElementMatcher.Junction<S> matcher = ElementMatchers.none(); for (LatentMatcher<? super S> latentMatcher : matchers) { matcher = matcher.or(latentMatcher.resolve(typeDescription)); } return 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 LatentMatcher.Disjunction)) return false; final LatentMatcher.Disjunction<?> other = (LatentMatcher.Disjunction<?>) o; if (!other.canEqual((java.lang.Object) this)) return false; final java.lang.Object this$matchers = this.matchers; final java.lang.Object other$matchers = other.matchers; if (this$matchers == null ? other$matchers != null : !this$matchers.equals(other$matchers)) return false; return true; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") protected boolean canEqual(final java.lang.Object other) { return other instanceof LatentMatcher.Disjunction; } @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 $matchers = this.matchers; result = result * PRIME + ($matchers == null ? 43 : $matchers.hashCode()); return result; } } }