コード例 #1
0
  private void handleField(Field field) {
    Annotation[] annotations = field.getDeclaredAnnotations();

    for (Annotation annotation : annotations) {
      if (annotation.annotationType().isAssignableFrom(Preference.class)) {
        Preference preferenceAnnotation = (Preference) annotation;

        if (!preferenceAnnotation.enabled()) {
          return;
        }

        if (!preferenceAnnotation.name().isEmpty()) {
          mFieldsPreferencesMap.put(preferenceAnnotation.name(), field);
          return;
        }
      }
    }

    mFieldsPreferencesMap.put(field.getName(), field);
  }