/** * Exactly matches a given method or constructor as a {@link MethodDescription} in its defined shape. * * @param method The method to match by its description * @param <T> The type of the matched object. * @return An element matcher that exactly matches the given method or constructor in its defined shape. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> is(MethodDescription.InDefinedShape method) { return definedMethod(new EqualityMatcher<MethodDescription.InDefinedShape>(method)); }
/** * Creates a matcher that matches any of the given constructors as {@link MethodDescription}s * by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}. * * @param value The input values to be compared against. * @param <T> The type of the matched object. * @return A matcher that checks for the equality with any of the given objects. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Constructor<?>... value) { return definedMethod(anyOf(new MethodList.ForLoadedMethods(value, new Method[0]))); }
/** * Creates a matcher that matches any of the given methods as {@link MethodDescription}s * by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}. * * @param value The input values to be compared against. * @param <T> The type of the matched object. * @return A matcher that checks for the equality with any of the given objects. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> anyOf(Method... value) { return definedMethod(anyOf(new MethodList.ForLoadedMethods(new Constructor<?>[0], value))); }
/** * Creates a matcher that matches none of the given constructors as {@link MethodDescription}s * by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}. * * @param value The input values to be compared against. * @param <T> The type of the matched object. * @return A matcher that checks for the equality with none of the given objects. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> noneOf(Constructor<?>... value) { return definedMethod(noneOf(new MethodList.ForLoadedMethods(value, new Method[0]))); }
/** * Creates a matcher that matches none of the given methods as {@link MethodDescription}s * by the {@link java.lang.Object#equals(Object)} method. None of the values must be {@code null}. * * @param value The input values to be compared against. * @param <T> The type of the matched object. * @return A matcher that checks for the equality with none of the given objects. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> noneOf(Method... value) { return definedMethod(noneOf(new MethodList.ForLoadedMethods(new Constructor<?>[0], value))); }
/** * {@inheritDoc} */ public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, FieldDescription fieldDescription, Assigner assigner, MethodAccessorFactory methodAccessorFactory) { return builder.method(definedMethod(is(getterMethod))).intercept(new FieldGetter(fieldDescription, assigner, methodAccessorFactory)); } }