Class ParameterizedBuilderHelper

    • Constructor Detail

      • ParameterizedBuilderHelper

        public ParameterizedBuilderHelper()
    • Method Detail

      • getAssignableValue

        public static Object getAssignableValue​(Class<?> clzRequiredType,
                                                Parameter parameter,
                                                ParameterResolver resolver,
                                                ClassLoader loader)
                                         throws ClassCastException
        Obtains an assignment compatible value of the required type given an actual Parameter.

        This allows us to accept parameters and produce an Object value that may be assigned using Java reflection.

        Parameters:
        clzRequiredType - the required type of value
        parameter - the actual Parameter from which to determine the value
        resolver - the ParameterResolver to resolve Parameters used in Parameters
        loader - the ClassLoader to use for loading necessary classes (required)
        Returns:
        an object that is assignable to the required type
        Throws:
        ClassCastException - when it's not possible to determine an assignable value
      • isAssignablePrimitive

        public static boolean isAssignablePrimitive​(Class<?> clzPrimitive,
                                                    Class<?> clzWrapper)
        Determines if a primitive type is assignable to a wrapper type.
        Parameters:
        clzPrimitive - the primitive class type
        clzWrapper - the wrapper class type
        Returns:
        true if primitive and wrapper are assignment compatible