List of usage examples for org.springframework.core ResolvableType forField
public static ResolvableType forField(Field field)
From source file:org.jdal.aop.config.SerializableAnnotationBeanPostProcessor.java
private ResolvableType getResolvableType(AnnotatedElement element) { if (element instanceof Field) return ResolvableType.forField((Field) element); else if (element instanceof Method) return ResolvableType.forMethodParameter(new MethodParameter((Method) element, 0)); throw new IllegalArgumentException("SerializableProxy annotation should only be applied on types" + ", fields or methods but was found in [" + element.toString() + "]"); }
From source file:com.ocs.dynamo.utils.ClassUtils.java
/** * Return a Class<?> representing the generic parameter for the given indexes. Indexes are zero * based; for example given the type Map<Integer, List<String>>, getGeneric(0) will access the * Integer. Nested generics can be accessed by specifying multiple indexes; for example * getGeneric(1, 0) will access the String from the nested List. For convenience, if no indexes * are specified the first generic is returned. * /*from w w w . ja va2s . c o m*/ * @param type * @param fieldName * @param indexes * @return */ public static <T> Class<?> getResolvedType(Class<T> type, String fieldName, int... indexes) { Field field = getField(type, fieldName); if (field != null) { ResolvableType rt = ResolvableType.forField(field); if (rt != null) { if (indexes != null && indexes.length > 0) { rt = rt.getGeneric(indexes); } if (rt != null) { return rt.resolve(); } } } return null; }
From source file:org.mule.module.extension.internal.util.IntrospectionUtils.java
/** * Returns a {@link DataType} describing * the given {@link java.lang.reflect.Field}'s type * * @param field a not {@code null} {@link java.lang.reflect.Field} * @return a {@link DataType} matching the field's type * @throws java.lang.IllegalArgumentException if field is {@code null} *//*from ww w. ja v a 2s.c o m*/ public static DataType getFieldDataType(Field field) { checkArgument(field != null, "Can't introspect a null field"); return toDataType(ResolvableType.forField(field)); }