|| !modifiers.contains(Modifier.FINAL) ) {
throw new RuntimeException("Field " + field.getSimpleName() + " is not declared public static final");
}
// Check suported types (int, long, float, String)
TypeMirror field_type = field.getType();
if ( field_type instanceof PrimitiveType ) {
PrimitiveType field_type_prim = (PrimitiveType)field_type;
PrimitiveType.Kind field_kind = field_type_prim.getKind();
if ( field_kind != PrimitiveType.Kind.INT
&& field_kind != PrimitiveType.Kind.LONG
&& field_kind != PrimitiveType.Kind.FLOAT
&& field_kind != PrimitiveType.Kind.BYTE ) {
throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'");
}
} else if ( "java.lang.String".equals(field_type.toString()) ) {
} else {
throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String");
}
Object field_value = field.getConstantValue();