@Test public void getFields() { Field[] result = cache.getFields(String.class); Field[] fields = ReflectionUtil.getAllFieldsOfClass(String.class); assertArrayEquals(result, fields); fieldSize = result.length; result = cache.getFields(AnnotationClass.class, AnnotationClass.Test.class); fields = ReflectionUtil.getAnnotationFields(AnnotationClass.class, AnnotationClass.Test.class); assertArrayEquals(result, fields); }
public Field[] getFields(final Class<?> clazz) { if (clazz == null) { return null; } return cache.get(ClassUtil.getFriendlyClassName(clazz), new Callable<Field[]>() { @Override public Field[] call() throws Exception { return ReflectionUtil.getAllFieldsOfClass(clazz, true); } }); }
FieldCache { public Field[] getFields(final Class<?> clazz) { if (clazz == null) { return null; } return cache.get(ClassUtil.getFriendlyClassName(clazz), new Callable<Field[]>() { @Override public Field[] call() throws Exception { return ReflectionUtil.getAllFieldsOfClass(clazz, true); } }); } }
FieldCache { public Field[] getFields(final Class<?> clazz) { if (clazz == null) { return null; } return cache.get(ClassUtil.getFriendlyClassName(clazz), new Callable<Field[]>() { @Override public Field[] call() throws Exception { return ReflectionUtil.getAllFieldsOfClass(clazz, true); } }); } private  FieldCache(); }
FieldCache { public Field[] getFields(final Class<?> clazz) { if (clazz == null) { return null; } return cache.get(ClassUtil.getFriendlyClassName(clazz), new Callable<Field[]>() { @Override public Field[] call() throws Exception { return ReflectionUtil.getAllFieldsOfClass(clazz, true); } }); } private  FieldCache(); static FieldCache getInstance(); Field[] getFields(final Class<?> clazz); Field[] getInstanceFields(final Class<?> clazz); Field[] getFields(final Class<?> clazz, final Class<? extends Annotation> annotationClass); Field getField(final Class<?> clazz, String fieldName); Field getInstanceField(final Class<?> clazz, String fieldName); Field getField(final Class<?> clazz, final Class<? extends Annotation> annotationClass, String fieldName); }
FieldCache { public Field[] getFields(final Class<?> clazz) { if (clazz == null) { return null; } return cache.get(ClassUtil.getFriendlyClassName(clazz), new Callable<Field[]>() { @Override public Field[] call() throws Exception { return ReflectionUtil.getAllFieldsOfClass(clazz, true); } }); } private  FieldCache(); static FieldCache getInstance(); Field[] getFields(final Class<?> clazz); Field[] getInstanceFields(final Class<?> clazz); Field[] getFields(final Class<?> clazz, final Class<? extends Annotation> annotationClass); Field getField(final Class<?> clazz, String fieldName); Field getInstanceField(final Class<?> clazz, String fieldName); Field getField(final Class<?> clazz, final Class<? extends Annotation> annotationClass, String fieldName);  }