Class MethodTypeUtil

java.lang.Object
ru.progrm_jarvis.javacommons.invoke.MethodTypeUtil

public final class MethodTypeUtil extends Object
Utilities related to method types.
  • Method Details

    • integrateTypes

      @NotNull public static @NotNull MethodType integrateTypes(@NonNull @NonNull MethodType original, int originalStartIndex, @NonNull @NonNull MethodType target, int targetStartIndex, int parameterCount)

      Integrates the original method-type with the target making so that specified target-type's parameters should be assignable from the corresponding ones of the integrated type.

      Note that indices are used to specify which parameter types should be integrated, e.g. if originalStartIndex is 2, targetStartIndex is 4 and parameterCount is 3 then the 2'nd original parameter will be integrated with the 4'th target parameter, the 3'rd original parameter will be integrated with the 5'th target parameter and the 4'th original parameter will be integrated with the 6'th target parameter.

      Parameters:
      original - original type which should be integrated to the target type
      originalStartIndex - index from which to start in the original
      target - target type to which the original type should be integrated
      targetStartIndex - index from which to start in the target
      parameterCount - amount of the parameters to integrate
      Returns:
      result of type integration, my be the same as original type
      Throws:
      IllegalArgumentException - if any index (including calculated last used indices) is out of its bounds
      IllegalArgumentException - if any original parameter type cannot be integrated to the target parameter type
      See Also:
    • integrateTypes

      @NotNull public static @NotNull MethodType integrateTypes(@NonNull @NonNull MethodType original, @NonNull @NonNull MethodType target)
      Shorthand for integrateTypes(MethodType, int, MethodType, int, int) for both types having the same amount of parameters each of which should be integrated.
      Parameters:
      original - original type which should be integrated to the target type
      target - target type to which the original type should be integrated
      Returns:
      result of type integration, my be the same as original type
      See Also: