- java.lang.Object
-
- com.google.gson.internal.reflect.ReflectionHelper
-
public class ReflectionHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description privateReflectionHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringconstructorToString(java.lang.reflect.Constructor<?> constructor)Creates a string representation for a constructor.static java.lang.RuntimeExceptioncreateExceptionForUnexpectedIllegalAccess(java.lang.IllegalAccessException exception)static voidmakeAccessible(java.lang.reflect.Field field)Tries making the field accessible, wrapping any thrown exception in aJsonIOExceptionwith descriptive message.static java.lang.StringtryMakeAccessible(java.lang.reflect.Constructor<?> constructor)Tries making the constructor accessible, returning an exception message if this fails.
-
-
-
Method Detail
-
makeAccessible
public static void makeAccessible(java.lang.reflect.Field field) throws JsonIOExceptionTries making the field accessible, wrapping any thrown exception in aJsonIOExceptionwith descriptive message.- Parameters:
field- field to make accessible- Throws:
JsonIOException- if making the field accessible fails
-
constructorToString
private static java.lang.String constructorToString(java.lang.reflect.Constructor<?> constructor)
Creates a string representation for a constructor. E.g.:java.lang.String#String(char[], int, int)
-
tryMakeAccessible
public static java.lang.String tryMakeAccessible(java.lang.reflect.Constructor<?> constructor)
Tries making the constructor accessible, returning an exception message if this fails.- Parameters:
constructor- constructor to make accessible- Returns:
- exception message;
nullif successful, non-nullif unsuccessful
-
createExceptionForUnexpectedIllegalAccess
public static java.lang.RuntimeException createExceptionForUnexpectedIllegalAccess(java.lang.IllegalAccessException exception)
-
-