lundi 3 juin 2019

How to get constants declared in a class as a map

I am trying to find a way to access constants and their declared in a class, from outside the class as a map

public final class MyConstants {
    public static final MY_CONST_1 = "CONST_1";
    public static final MY_CONST_2 = "CONST_2";
    public static final MY_CONST_3 = "CONST_3";
    public static final MY_CONST_4 = "CONST_4";
}

My attempt is to get all constants declared in MyConstants in a map with name of the const as the key and value as the value





Aucun commentaire:

Enregistrer un commentaire