Class ReflectionHelper

java.lang.Object
com.google.gson.internal.reflect.ReflectionHelper

public class ReflectionHelper extends Object
  • Constructor Details

    • ReflectionHelper

      private ReflectionHelper()
  • Method Details

    • makeAccessible

      public static void makeAccessible(Field field) throws JsonIOException
      Tries making the field accessible, wrapping any thrown exception in a JsonIOException with descriptive message.
      Parameters:
      field - field to make accessible
      Throws:
      JsonIOException - if making the field accessible fails
    • constructorToString

      private static String constructorToString(Constructor<?> constructor)
      Creates a string representation for a constructor. E.g.: java.lang.String#String(char[], int, int)
    • tryMakeAccessible

      public static String tryMakeAccessible(Constructor<?> constructor)
      Tries making the constructor accessible, returning an exception message if this fails.
      Parameters:
      constructor - constructor to make accessible
      Returns:
      exception message; null if successful, non-null if unsuccessful
    • createExceptionForUnexpectedIllegalAccess

      public static RuntimeException createExceptionForUnexpectedIllegalAccess(IllegalAccessException exception)