Class IntrospectionUtils

    • Constructor Detail

      • IntrospectionUtils

        public IntrospectionUtils()
    • Method Detail

      • getBoxedClass

        public static Class<?> getBoxedClass​(Class clazz)
        returns boxed type (or input type if not a primitive type)
        Parameters:
        clazz - input class
        Returns:
        boxed class
      • getUnboxedClass

        public static Class<?> getUnboxedClass​(Class clazz)
        returns unboxed type (or input type if not successful)
        Parameters:
        clazz - input class
        Returns:
        unboxed class
      • getTypeClass

        public static Class<?> getTypeClass​(Type type)
        returns the Class corresponding to a Type, if possible
        Parameters:
        type - the input Type
        Returns:
        found Class, if any
      • isMethodInvocationConvertible

        public static boolean isMethodInvocationConvertible​(Type formal,
                                                            Class<?> actual,
                                                            boolean possibleVarArg)
        Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, treating object types of primitive types as if they were primitive types (that is, a Boolean actual parameter type matches boolean primitive formal type). This behavior is because this method is used to determine applicable methods for an actual parameter list, and primitive types are represented by their object duals in reflective method calls.
        Parameters:
        formal - the formal parameter type to which the actual parameter type should be convertible
        actual - the actual parameter type.
        possibleVarArg - whether or not we're dealing with the last parameter in the method declaration
        Returns:
        true if either formal type is assignable from actual type, or formal is a primitive type and actual is its corresponding object type or an object type of a primitive type that can be converted to the formal type.
      • isStrictMethodInvocationConvertible

        public static boolean isStrictMethodInvocationConvertible​(Type formal,
                                                                  Class<?> actual,
                                                                  boolean possibleVarArg)
        Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, without matching object and primitive types. This method is used to determine the more specific type when comparing signatures of methods.
        Parameters:
        formal - the formal parameter type to which the actual parameter type should be convertible
        actual - the actual parameter type.
        possibleVarArg - whether or not we're dealing with the last parameter in the method declaration
        Returns:
        true if either formal type is assignable from actual type, or formal and actual are both primitive types and actual can be subject to widening conversion to formal.