/** * Attempt to find a {@link Field field} on the supplied {@link Class} with the supplied <code>name</code>. * * Searches all superclasses up to {@link Object}. * * @param clazz the class to introspect * @param name the name of the field * @return the corresponding Field object, or <code>null</code> if not found */ public static Field findField(Class<?> clazz, String name) { return findField(clazz, name, null); }
if(null == Reflection.findField(RequestMappingHandlerMapping.class, "mappingRegistry")) { log.error("Can't find 'mappingRegistry' field at '" + RequestMappingHandlerMapping.class + "'"); return; Field field = Reflection.findField(mapping.getClass(), "mappingRegistry"); if(null == field) { log.info("Can't find 'mappingRegistry' field at '" + mapping.getClass() + "'"); field = Reflection.findField(registry.getClass(), "registry"); if (null == field) { log.error("Can't find 'registry' field at '" + registry.getClass() + "'"); Field field1 = Reflection.findField(v.getClass(), "handlerMethod"); if (null != field1) { try {
public static MSimpleType tryForClass(Class<?> cls) { if(cls.isEnum()){ Field field = Reflection.findField(cls, "value"); if(null != field) { return tryForClass(field.getType()); }else{ return tryForClass(String.class); } } for(MSimpleType t : all()){ if(t.getJavaType().equals(cls)){ return t; } } for(MSimpleType t : all()){ for(Class<?> javaType : t.getJavaTypes()){ if(javaType.equals(cls)){ return t; } } } return null; }