/** * <p> * Creates a matcher that matches any of the given objects by the {@link java.lang.Object#equals(Object)} method. * None of the values must be {@code null}. * </p> * <p> * <b>Important</b>: This method cannot be used interchangeably with any of its overloaded versions which also apply a type * conversion. * </p> * * @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> ElementMatcher.Junction<T> anyOf(Object... value) { return anyOf(Arrays.asList(value)); }
/** * Creates a matcher that matches any of the given types as {@link TypeDescription}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 TypeDefinition> ElementMatcher.Junction<T> anyOf(Type... value) { return anyOf(new TypeList.Generic.ForLoadedTypes(value)); }
/** * Creates a matcher that matches any of the given annotations as {@link AnnotationDescription}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 AnnotationDescription> ElementMatcher.Junction<T> anyOf(Annotation... value) { return anyOf(new AnnotationList.ForLoadedAnnotations(value)); }
/** * 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 any of the given fields as {@link FieldDescription}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 FieldDescription> ElementMatcher.Junction<T> anyOf(Field... value) { return definedField(anyOf(new FieldList.ForLoadedFields(value))); }
/** * Matches a type variable with the given name. * * @param matcher A matcher for the type variable's name. * @param <T> The type of the matched object. * @return A matcher that matches type variables with the given name. */ public static <T extends TypeDefinition> ElementMatcher.Junction<T> isVariable(ElementMatcher<? super NamedElement> matcher) { return new TypeSortMatcher<T>(anyOf(TypeDefinition.Sort.VARIABLE, TypeDefinition.Sort.VARIABLE_SYMBOLIC)).and(matcher); }
ElementMatchers.anyOf(Map.class, Collection.class, RObject.class)))); for (InDefinedShape field : fields) { throw new IllegalArgumentException("RIndex annotation couldn't be defined for field '" + field.getName() + "' with type '" + field.getType() + "'");
ElementMatchers.anyOf(Map.class, Collection.class, RObject.class)))); for (InDefinedShape field : fields) { throw new IllegalArgumentException("RIndex annotation couldn't be defined for field '" + field.getName() + "' with type '" + field.getType() + "'");
/** * Matches any Java bean getter method. * * @param <T> The type of the matched object. * @return A matcher that matches any getter method. */ public static <T extends MethodDescription> ElementMatcher.Junction<T> isGetter() { return takesArguments(0).and(not(returns(TypeDescription.VOID))).and(nameStartsWith("get").or(nameStartsWith("is").and(returnsGeneric(anyOf(boolean.class, Boolean.class))))); }
ElementMatcher<? super MethodDescription> relevanceMatcher = (ElementMatcher<? super MethodDescription>) not(anyOf(implementations.keySet())) .and(returns(isVisibleTo(instrumentedType))) .and(hasParameters(whereNone(hasType(not(isVisibleTo(instrumentedType))))))
@Override public final boolean matches(TypeDescription target) { return target.isPrimitive() || target.isPrimitiveWrapper() || anyOf(JAVA_ATOMS).matches(target); } }
ElementMatchers.anyOf(Map.class, Collection.class, RObject.class)))); for (InDefinedShape field : fields) { throw new IllegalArgumentException("RIndex annotation couldn't be defined for field '" + field.getName() + "' with type '" + field.getType() + "'");
private static Class<? extends Server> getProxyClass(Class<?>[] interfaces, boolean callOnVoidMethods) { final Pair<Set<Class<?>>, Boolean> key = new Pair(ImmutableSet.copyOf(interfaces), callOnVoidMethods); Class<? extends Server> clazz = classes.get(key); if (clazz == null) { clazz = new ByteBuddy() // http://bytebuddy.net/ .subclass(Server.class) .implement(interfaces) .implement(java.io.Serializable.class) .method(isDeclaredBy(anyOf(interfaces))).intercept(InvocationHandlerAdapter.of(callOnVoidMethods ? handler1 : handler2)) .make() .load(ProxyServerActor.class.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER).getLoaded(); final Class<? extends Server> old = classes.putIfAbsent(key, clazz); if (old != null) clazz = old; } return clazz; }