java.lang.Object
dk.cloudcreate.essentials.shared.reflection.Parameters

public class Parameters extends Object
Utility class for working with Methods/Method parameters and Constructors/Constructor declaration parameters or method/constructor call arguments
  • Constructor Details

    • Parameters

      public Parameters()
  • Method Details

    • parameterTypesMatches

      public static boolean parameterTypesMatches(Class<?>[] actualParameterTypes, Class<?>[] declaredParameterTypes, boolean exactMatch)
      Check if an array of actual-parameter-types MATCH an array of declared-parameter-types while taking null actual parameter types and BoxedTypes.boxedType(java.lang.Class<?>) into consideration (in case exactMatch is false)
      Parameters:
      actualParameterTypes - the actual parameter types (deduced from actual parameter values)
      declaredParameterTypes - the declared parameter types defined on the Method or Constructor
      exactMatch - Must the match be exact (each parameter type MUST match precisely)
      or do we allow testing using BoxedTypes.boxedType(Class), null actualParameterTypes and isAssignableFrom checks to bypass individual type matches
      Returns:
      true if the parameter types match or not
    • argumentTypes

      public static Class<?>[] argumentTypes(Object... arguments)
      Convert method/constructor call arguments to their corresponding types.
      null values are represented using the Parameters.NULL_ARGUMENT_TYPE type
      Parameters:
      arguments - arguments
      Returns:
      the argument types