public abstract Object getConstantValue ()

Returns the value of this variable if this is a final field initialized to a compile-time constant. Returns null otherwise. The value will be of a primitive type or a String. If the value is of a primitive type, it is wrapped in the appropriate wrapper class (such as Integer).

Note that not all final fields will have constant values. In particular, enum constants are not considered to be compile-time constants. To have a constant value, a field's type must be either a primitive type or String.

Returns:  the value of this variable if this is a final field initialized to a compile-time constant, or null otherwise

See also:
Elements.getConstantExpression(Object)

@jls 15.28 Constant Expression
@jls 4.12.4 final Variables