Class MethodTypeUtil
java.lang.Object
ru.progrm_jarvis.javacommons.invoke.MethodTypeUtil
Utilities related to
method types.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull MethodTypeintegrateTypes(@NonNull MethodType original, int originalStartIndex, @NonNull MethodType target, int targetStartIndex, int parameterCount) Integrates the originalmethod-typewith the target making so that specifiedtarget-type's parameters should be assignable from the corresponding ones of theintegrated type.static @NotNull MethodTypeintegrateTypes(@NonNull MethodType original, @NonNull MethodType target) Shorthand forintegrateTypes(MethodType, int, MethodType, int, int)for both types having the same amount of parameters each of which should be integrated.
-
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-typewith the target making so that specifiedtarget-type's parameters should be assignable from the corresponding ones of theintegrated type.Note that indices are used to specify which parameter types should be integrated, e.g. if
originalStartIndexis2,targetStartIndexis4andparameterCountis3then 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 typeoriginalStartIndex- index from which to start in the originaltarget- target type to which the original type should be integratedtargetStartIndex- index from which to start in the targetparameterCount- 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 boundsIllegalArgumentException- 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 forintegrateTypes(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 typetarget- target type to which the original type should be integrated- Returns:
- result of type integration, my be the same as original type
- See Also:
-