/** * Look through all of the declared, static, final fields of the context object, grab the value, * and insert a mapping from the field's name to the object. * * Note that this will index non-public fields. * * @return the bindable constants map * @throws IllegalArgumentException on reflection error * @throws IllegalAccessException on reflection error */ private Map<String, Object> indexBindableConstants() throws IllegalArgumentException, IllegalAccessException { Map<String, Object> map = Maps.newHashMap(); for (Field field : object.getClass().getDeclaredFields()) { boolean accessible = field.isAccessible(); field.setAccessible(true); if (Reflections.isFieldFinal(field) && Reflections.isFieldStatic(field)) { map.put(field.getName(), field.get(object)); } field.setAccessible(accessible); } return map; }