Class ReflectionHelper


  • public class ReflectionHelper
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ReflectionHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String constructorToString​(java.lang.reflect.Constructor<?> constructor)
      Creates a string representation for a constructor.
      static java.lang.RuntimeException createExceptionForUnexpectedIllegalAccess​(java.lang.IllegalAccessException exception)  
      static void makeAccessible​(java.lang.reflect.Field field)
      Tries making the field accessible, wrapping any thrown exception in a JsonIOException with descriptive message.
      static java.lang.String tryMakeAccessible​(java.lang.reflect.Constructor<?> constructor)
      Tries making the constructor accessible, returning an exception message if this fails.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReflectionHelper

        private ReflectionHelper()
    • Method Detail

      • makeAccessible

        public static void makeAccessible​(java.lang.reflect.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 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; null if successful, non-null if unsuccessful
      • createExceptionForUnexpectedIllegalAccess

        public static java.lang.RuntimeException createExceptionForUnexpectedIllegalAccess​(java.lang.IllegalAccessException exception)