public class RoutineBuilders extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RoutineBuilders.MethodInfo
Data class storing information about the target method.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
callFromInvocation(Mutex mutex,
Object target,
Method targetMethod,
List<?> objects,
ResultChannel<Object> result,
Input.InputMode inputMode,
Output.OutputMode outputMode)
Calls the specified target method from inside a routine invocation.
|
static InvocationConfiguration |
configurationWithAnnotations(InvocationConfiguration configuration,
Method method)
Returns a configuration properly modified by taking into account the annotations added to the
specified method.
|
static ProxyConfiguration |
configurationWithAnnotations(ProxyConfiguration configuration,
Method method)
Returns a configuration properly modified by taking into account the annotations added to the
specified method.
|
static Method |
getAnnotatedMethod(Class<?> targetClass,
String name)
Gets the method annotated with the specified alias name.
|
static Input.InputMode |
getInputMode(Method method,
int index)
Gets the input transfer mode associated to the specified method parameter, while also
validating the use of the
Input annotation.In case no annotation is present, the function will return with null. |
static Invoke.InvocationMode |
getInvocationMode(Method method)
Gets the routine invocation mode associated to the specified method, while also validating
the use of the
Invoke annotation.In case no annotation is present, the function will return with null. |
static Output.OutputMode |
getOutputMode(Method method,
Class<?> targetReturnType)
Gets the output transfer mode of the return type of the specified method, while also
validating the use of the
Output annotation.In case no annotation is present, the function will return with null. |
static Mutex |
getSharedMutex(Object target,
List<String> sharedFields)
Returns the cached mutex associated with the specified target and shared fields.
If the cache was empty, it is filled with a new object automatically created. If the target is null Mutex.NO_MUTEX will be returned. |
static RoutineBuilders.MethodInfo |
getTargetMethodInfo(Class<?> targetClass,
Method proxyMethod)
Gets info about the method targeted by the specified proxy one.
|
static Object |
invokeRoutine(Routine<Object,Object> routine,
Method method,
Object[] args,
Invoke.InvocationMode invocationMode,
Input.InputMode inputMode,
Output.OutputMode outputMode)
Invokes the routine wrapping the specified method.
|
public static void callFromInvocation(@NotNull
Mutex mutex,
@NotNull
Object target,
@NotNull
Method targetMethod,
@NotNull
List<?> objects,
@NotNull
ResultChannel<Object> result,
@Nullable
Input.InputMode inputMode,
@Nullable
Output.OutputMode outputMode)
mutex - the method mutex.target - the target instance.targetMethod - the target method.objects - the input objects.result - the invocation result channel.inputMode - the input transfer mode.outputMode - the output transfer mode.RoutineException - in case of errors.@NotNull public static InvocationConfiguration configurationWithAnnotations(@Nullable InvocationConfiguration configuration, @NotNull Method method)
configuration - the initial configuration.method - the target method.CoreInstances,
InputMaxSize,
InputOrder,
InputTimeout,
LogLevel,
MaxInstances,
OutputMaxSize,
OutputOrder,
OutputTimeout,
Priority,
ReadTimeout,
ReadTimeoutAction@NotNull public static ProxyConfiguration configurationWithAnnotations(@Nullable ProxyConfiguration configuration, @NotNull Method method)
configuration - the initial configuration.method - the target method.SharedFields@Nullable public static Method getAnnotatedMethod(@NotNull Class<?> targetClass, @NotNull String name)
targetClass - the target class.name - the alias name.IllegalArgumentException - if no method with the specified alias name was
found.@Nullable public static Input.InputMode getInputMode(@NotNull Method method, int index)
Input annotation.method - the proxy method.index - the index of the parameter.IllegalArgumentException - if the method has been incorrectly annotated.Input@Nullable public static Invoke.InvocationMode getInvocationMode(@NotNull Method method)
Invoke annotation.method - the proxy method.IllegalArgumentException - if the method has been incorrectly annotated.Invoke@Nullable public static Output.OutputMode getOutputMode(@NotNull Method method, @NotNull Class<?> targetReturnType)
Output annotation.method - the proxy method.targetReturnType - the target return type.IllegalArgumentException - if the method has been incorrectly annotated.Output@NotNull public static Mutex getSharedMutex(@Nullable Object target, @Nullable List<String> sharedFields)
Mutex.NO_MUTEX will be returned.target - the target object instance.sharedFields - the shared field names.@NotNull public static RoutineBuilders.MethodInfo getTargetMethodInfo(@NotNull Class<?> targetClass, @NotNull Method proxyMethod)
targetClass - the target class.proxyMethod - the proxy method.IllegalArgumentException - if no target method was found.@Nullable public static Object invokeRoutine(@NotNull Routine<Object,Object> routine, @NotNull Method method, @NotNull Object[] args, @Nullable Invoke.InvocationMode invocationMode, @Nullable Input.InputMode inputMode, @Nullable Output.OutputMode outputMode)
routine - the routine to be called.method - the target method.args - the method arguments.invocationMode - the routine invocation mode.inputMode - the input transfer mode.outputMode - the output transfer mode.RoutineException - in case of errors.