/** * Create a parameterized type instance. * * @param raw the raw class to create a parameterized type instance for * @param typeArguments the types used for parameterization * @return {@link ParameterizedType} * @since 3.2 */ public static final ParameterizedType parameterize(final Class<?> raw, final Type... typeArguments) { return parameterizeWithOwner(null, raw, typeArguments); }
/** * {@inheritDoc} */ @Override public String toString() { return TypeUtils.toString(this); }
/** * Removes the final modifier from a {@link Field}. * * @param field * to remove the final modifier * @throws IllegalArgumentException * if the field is {@code null} * @since 3.2 */ public static void removeFinalModifier(final Field field) { removeFinalModifier(field, true); }
/** * Gets an accessible {@link Field} by name respecting scope. Superclasses/interfaces will be considered. * * @param cls * the {@link Class} to reflect, must not be {@code null} * @param fieldName * the field name to obtain * @return the Field object * @throws IllegalArgumentException * if the class is {@code null}, or the field name is blank or empty */ public static Field getField(final Class<?> cls, final String fieldName) { final Field field = getField(cls, fieldName, false); MemberUtils.setAccessibleWorkaround(field); return field; }
/** * <p>Checks if the subject type may be implicitly cast to the target type * following the Java generics rules. If both types are {@link Class} * objects, the method returns the result of * {@link ClassUtils#isAssignable(Class, Class)}.</p> * * @param type the subject type to be assigned to the target type * @param toType the target type * @return {@code true} if {@code type} is assignable to {@code toType}. */ public static boolean isAssignable(final Type type, final Type toType) { return isAssignable(type, toType, null); }
private ReadWriteLock getLockInProcessQueue(ProcessQueue pq) { try { return (ReadWriteLock) FieldUtils.readDeclaredField(pq, "lockTreeMap", true); } catch (IllegalAccessException e) { return null; } } }
/** * Reads an accessible {@code static} {@link Field}. * * @param field * to read * @return the field value * @throws IllegalArgumentException * if the field is {@code null}, or not {@code static} * @throws IllegalAccessException * if the field is not accessible */ public static Object readStaticField(final Field field) throws IllegalAccessException { return readStaticField(field, false); }
/** * Gets all class level public methods of the given class that are annotated with the given annotation. * @param cls * the {@link Class} to query * @param annotationCls * the {@link Annotation} that must be present on a method to be matched * @return a list of Methods (possibly empty). * @throws IllegalArgumentException * if the class or annotation are {@code null} * @since 3.4 */ public static List<Method> getMethodsListWithAnnotation(final Class<?> cls, final Class<? extends Annotation> annotationCls) { return getMethodsListWithAnnotation(cls, annotationCls, false, false); }
/** * Gets an accessible {@link Field} by name respecting scope. Only the specified class will be considered. * * @param cls * the {@link Class} to reflect, must not be {@code null} * @param fieldName * the field name to obtain * @return the Field object * @throws IllegalArgumentException * if the class is {@code null}, or the field name is blank or empty */ public static Field getDeclaredField(final Class<?> cls, final String fieldName) { return getDeclaredField(cls, fieldName, false); }
@Override public final boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof TypeLiteral)) { return false; } final TypeLiteral<?> other = (TypeLiteral<?>) obj; return TypeUtils.equals(value, other.value); }
/** * Wrap the specified {@link Class} in a {@link Typed} wrapper. * * @param <T> generic type * @param type to wrap * @return Typed<T> * @since 3.2 */ public static <T> Typed<T> wrap(final Class<T> type) { return wrap((Type) type); }
private static Executable of(final Method method) { return new Executable(method); }
static boolean isMatchingMethod(final Method method, final Class<?>[] parameterTypes) { return isMatchingExecutable(Executable.of(method), parameterTypes); }
/** * {@inheritDoc} */ @Override public WildcardType build() { return new WildcardTypeImpl(upperBounds, lowerBounds); } }
/** * Get a {@link WildcardTypeBuilder}. * @return {@link WildcardTypeBuilder} * @since 3.2 */ public static WildcardTypeBuilder wildcardType() { return new WildcardTypeBuilder(); }
static void verify(final ImmutablePair<String, Object[]> a, final Object _b) { @SuppressWarnings("unchecked") final ImmutablePair<String, Object[]> b = (ImmutablePair<String, Object[]>) _b; verify(a, b); }
/** * {@inheritDoc} */ @Override public String toString() { return TypeUtils.toString(this); }
private static Executable of(final Constructor<?> constructor) { return new Executable(constructor); }
static boolean isMatchingConstructor(final Constructor<?> method, final Class<?>[] parameterTypes) { return isMatchingExecutable(Executable.of(method), parameterTypes); }
/** * {@inheritDoc} */ @Override public String toString() { return TypeUtils.toString(this); }