Get name of a field

后端 未结 7 975
日久生厌
日久生厌 2020-12-03 02:43

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;
         


        
7条回答
  •  孤街浪徒
    2020-12-03 03:31

    This is only possible via reflection.

    Use Class.getDeclaringFields() and java.reflection.Field.getName()

提交回复
热议问题