Reflecting
Reflect a field by name (will return null if not found):
Class clazz;
Field f = new Mirror().on(clazz).reflect().field("fieldName");
Reflecting all fields of a class (will return an empty list if none found):
Class clazz;
List<Field> l = new Mirror().on(clazz).reflectAll().fields();
Reflecting all fields of a class that matches a Matcher<Field> (will return an empty list if none found):
Class clazz;
List<Field> l = new Mirror().on(clazz).reflectAll().fields()
.matching(new YourCustomMatcher());
You can also map your fields to other types:
Class clazz;
List<String> l = new Mirror().on(clazz).reflectAll().fields()
.mappingTo(new YourFieldToStringMapper());