Class ClassConstantInspector
- java.lang.Object
-
- org.silverpeas.core.web.jstl.constant.reflect.ClassConstantInspector
-
public class ClassConstantInspector extends Object
Inspector class that analyses a class and extract its constant filed value.
-
-
Constructor Summary
Constructors Constructor Description ClassConstantInspector(String constantPath)
Constructs a class constant inspector for the passed field.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getValue()
Returns the value of the inspected class constant.static Object
getValue(String constantName)
Static convenience method to obtain the value of a constant.
-
-
-
Constructor Detail
-
ClassConstantInspector
public ClassConstantInspector(String constantPath) throws ClassNotFoundException, NoSuchFieldException
Constructs a class constant inspector for the passed field. The field is checked to ensure that it is a public static final field.- Parameters:
constantPath
- the fully qualified name of the class class constant- Throws:
ClassNotFoundException
- if the named class does not existNoSuchFieldException
- if the named field does not existsIllegalArgumentException
- if the class or field fails to meet the constrictions described above
-
-
Method Detail
-
getValue
public Object getValue() throws IllegalAccessException, InstantiationException
Returns the value of the inspected class constant.- Returns:
- the value of the inspected constant
- Throws:
IllegalAccessException
- if the field cannot be accessedInstantiationException
- if the class cannot be instantiated
-
getValue
public static Object getValue(String constantName) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException
Static convenience method to obtain the value of a constant. Suitable for use as an EL function.- Parameters:
constantName
- the fully qualified name of the class class constant- Returns:
- the value of the inspected constant
- Throws:
NoSuchFieldException
- if the field does not existClassNotFoundException
- if the class does not existIllegalAccessException
- if the field cannot be accessedInstantiationException
- if the class cannot be instantiated
-
-