Is it possible in Java to get a name of field in string from the actual field? like:
public class mod {
@ItemID
public static ItemLinkTool linkTool;
I think this is what you are looking for.
SomeClass data; // or List data; etc.
List fieldNames = getFieldNamesForClass(data.get(0).getClass());
private static List getFieldNamesForClass(Class> clazz) throws Exception {
List fieldNames = new ArrayList();
Field[] fields = clazz.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
fieldNames.add(fields[i].getName());
}
return fieldNames;
}