Class ReflectionUtils
java.lang.Object
org.eclipse.lemminx.extensions.xerces.ReflectionUtils
Java reflection utilities. In LemMinx context (with LemMinx binary context),
Java reflection should be forbidden. But to fix some Xerces bugs and improve
some Xerces feature, Java reflection is required to get access to some field
which are private. It's one reason why this
ReflectionUtils is in the
xerces package and not in the org.eclipse.lemminx.utils package.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetFieldValue(Object instance, String name) Returns the field value of the given instance and field name.static <T> voidsetFieldValue(Object instance, String name, T value)
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
getFieldValue
public static <T> T getFieldValue(Object instance, String name) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException Returns the field value of the given instance and field name.- Type Parameters:
T- the field value type.- Parameters:
instance- the instance.name- the field name.- Returns:
- the field value of the given instance and field name.
- Throws:
NoSuchFieldExceptionSecurityExceptionIllegalArgumentExceptionIllegalAccessException
-
setFieldValue
public static <T> void setFieldValue(Object instance, String name, T value) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
-