@Test public void test_locateAnnotated() { List<String> fields = locator.gatherFieldIds(Dummy.class); assertNotNull(fields); assertEquals(5, fields.size()); assertEquals(Arrays.asList("field1", "field2", "fieldThree", "fieldA", "FieldB"), fields); }
public List<String> gatherFieldIds(Class<?> clazz) { List<String> fieldNames = new ArrayList<String>(); for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String id = field.getAnnotation(Field.class).value(); if (id == null || id.trim().length() == 0) { id = field.getName(); } fieldNames.add(id); } return fieldNames; }
FieldLocator { public List<String> gatherFieldIds(Class<?> clazz) { List<String> fieldNames = new ArrayList<String>(); for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String id = field.getAnnotation(Field.class).value(); if (id == null || id.trim().length() == 0) { id = field.getName(); } fieldNames.add(id); } return fieldNames; } }
FieldLocator { public List<String> gatherFieldIds(Class<?> clazz) { List<String> fieldNames = new ArrayList<String>(); for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String id = field.getAnnotation(Field.class).value(); if (id == null || id.trim().length() == 0) { id = field.getName(); } fieldNames.add(id); } return fieldNames; }  }
FieldLocator { public List<String> gatherFieldIds(Class<?> clazz) { List<String> fieldNames = new ArrayList<String>(); for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String id = field.getAnnotation(Field.class).value(); if (id == null || id.trim().length() == 0) { id = field.getName(); } fieldNames.add(id); } return fieldNames; }  List<String> gatherFieldIds(Class<?> clazz); ReflectionField locateById(Class<?> clazz, String id); }
FieldLocator { public List<String> gatherFieldIds(Class<?> clazz) { List<String> fieldNames = new ArrayList<String>(); for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String id = field.getAnnotation(Field.class).value(); if (id == null || id.trim().length() == 0) { id = field.getName(); } fieldNames.add(id); } return fieldNames; }  List<String> gatherFieldIds(Class<?> clazz); ReflectionField locateById(Class<?> clazz, String id);  }