Class EnumConstants
- java.lang.Object
-
- com.tonic.analysis.source.recovery.EnumConstants
-
public final class EnumConstants extends Object
Resolves an enum's constants by ordinal and by name.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringnameByOrdinal(ClassPool pool, String enumInternalName, int ordinal)Looks up the enum constant declared at a given position.static IntegerordinalByName(ClassPool pool, String enumInternalName, String constantName)Looks up the declaration position of a named enum constant.
-
-
-
Method Detail
-
nameByOrdinal
public static String nameByOrdinal(ClassPool pool, String enumInternalName, int ordinal)
Looks up the enum constant declared at a given position.- Parameters:
pool- the class pool to resolve the enum from, may be null to force the reflection pathenumInternalName- the enum class, in dotted or internal formordinal- the declaration position- Returns:
- the constant name, or null if the enum could not be resolved or the ordinal is out of range
-
ordinalByName
public static Integer ordinalByName(ClassPool pool, String enumInternalName, String constantName)
Looks up the declaration position of a named enum constant.- Parameters:
pool- the class pool to resolve the enum from, may be null to force the reflection pathenumInternalName- the enum class, in dotted or internal formconstantName- the constant to find- Returns:
- the ordinal, or null if the enum or the constant could not be resolved
-
-