Classes { public static void setFieldValue(Object object, Field field, Object value) { Preconditions.checkNotNull(object,"object 参数应非空"); Preconditions.checkNotNull(object,"field 参数应非空"); try { field.setAccessible(true); field.set(object, value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }  static Set<Class<?>> getInterfacesOf( Type type ); static Set<Type> getGenericInterfacesOf( Type type ); static Set<Class<?>> getInterfacesWithMethods( Set<Class<?>> interfaces ); static Set<Class<?>> getClassesOf( Type type ); static Set<Class<?>> getSuperClassesOf( Type type ); static Set<Class<?>> getTypesOf( Type type ); static Class<?>[] toClassArray( Set<Class<?>> types ); static Type getActualTypeOf( Type type ); static String getSimpleGenericName( Type type ); static Class<?> getRawClass( final Type genericType ); static List<Constructor<?>> getConstructorsOf( Class<?> clazz ); static List<Method> getMethodsOf( Class<?> clazz ); static List<Field> getFieldsOf( Class<?> clazz ); static Type resolveTypeVariable( TypeVariable<?> name, Class<?> declaringClass, Class<?> topClass ); static String toURI( final Class<?> clazz ); static String toURI( String className ); static String toClassName( String uri ); static String normalizeClassToURI( String className ); static String denormalizeURIToClass( String uriPart ); static Object getFieldValue(Object object, String fieldName); static Class<?> getGenericParameterType(Class<?> implClass,
			Class<?> superClass,int positon); @SafeVarargs static List<Field> getFieldsOf(Class<?> clazz,
			  Predicate<Field> ... predicates); @SuppressWarnings("unchecked") static T newInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T newInstance(String clazz); static A getAnnotationOf(Class<?> type ,Class<A> annotationClass); static void setFieldValue(Object object, Field field, Object value); static void setFieldValue(Object root,String path, Object value); static Object getFieldValueByPath(Object root,String path); static Object getFieldValue(Object object, Field field); static Object safeGetFieldValue(Object object, Field field); static Field safeGetFieldOf(Class<?> clazz, String name); static Field getFieldOf(Class<?> clazz, String name);  }
@Test public void test1(){ assertEquals(null,fieldValue("/b")); Classes.setFieldValue(this,"/b","s"); assertEquals("s",b); assertEquals("s",fieldValue("/b")); Classes.setFieldValue(this,"/a/s","s"); assertEquals("s",a.s); assertEquals("s",fieldValue("/a/s")); Classes.setFieldValue(this,"/a/s/notExsits","s"); Classes.setFieldValue(this,"","s"); Classes.setFieldValue(this,"/","s"); }