public class ServiceBuilder extends Object
Created by davide-maestroni on 03/06/2016.
| Modifier and Type | Method and Description |
|---|---|
<IN,OUT> RoutineBuilder<IN,OUT> |
with(Class<? extends Invocation<IN,OUT>> invocationClass)
Returns a routine builder based on an invocation factory creating instances of the specified
class.
|
<IN,OUT> RoutineBuilder<IN,OUT> |
with(Class<? extends Invocation<IN,OUT>> invocationClass,
Object... args)
Returns a routine builder based on an invocation factory creating instances of the specified
class by passing the specified arguments to the class constructor.
|
<IN,OUT> RoutineBuilder<IN,OUT> |
with(ClassToken<? extends Invocation<IN,OUT>> invocationToken)
Returns a routine builder based on an invocation factory creating instances of the specified
class token.
|
<IN,OUT> RoutineBuilder<IN,OUT> |
with(ClassToken<? extends Invocation<IN,OUT>> invocationToken,
Object... args)
Returns a routine builder based on an invocation factory creating instances of the specified
class token by passing the specified arguments to the class constructor.
|
ServiceObjectProxyRoutineBuilder |
with(ContextInvocationTarget<?> target)
Returns a builder of routines running in a Service based on the builder context, wrapping the
specified target object.
|
<IN,OUT> RoutineBuilder<IN,OUT> |
with(Invocation<IN,OUT> invocation)
Returns a routine builder based on an invocation factory creating instances of the specified
object.
|
<IN,OUT> RoutineBuilder<IN,OUT> |
with(Invocation<IN,OUT> invocation,
Object... args)
Returns a routine builder based on an invocation factory creating instances of the specified
object.
|
<IN,OUT> ServiceRoutineBuilder<IN,OUT> |
with(TargetInvocationFactory<IN,OUT> target)
Returns a builder of routines running in a Service based on the builder context.
|
ServiceObjectProxyRoutineBuilder |
withClassOfType(Class<?> targetClass)
Returns a builder of routines running in a Service, wrapping the specified target class.
|
ServiceObjectProxyRoutineBuilder |
withInstanceOf(Class<?> targetClass)
Returns a builder of routines running in a Service, wrapping the specified target object.
|
ServiceObjectProxyRoutineBuilder |
withInstanceOf(Class<?> targetClass,
Object... factoryArgs)
Returns a builder of routines running in a Service, wrapping the specified target object.
|
@NotNull public <IN,OUT> RoutineBuilder<IN,OUT> with(@NotNull Class<? extends Invocation<IN,OUT>> invocationClass)
ContextInvocation.IN - the input data type.OUT - the output data type.invocationClass - the invocation class.IllegalArgumentException - if no default constructor was found.@NotNull public <IN,OUT> RoutineBuilder<IN,OUT> with(@NotNull Class<? extends Invocation<IN,OUT>> invocationClass, @Nullable Object... args)
ContextInvocation.IN - the input data type.OUT - the output data type.invocationClass - the invocation class.args - the invocation constructor arguments.IllegalArgumentException - if no constructor taking the specified objects
as parameters was found.@NotNull public <IN,OUT> RoutineBuilder<IN,OUT> with(@NotNull ClassToken<? extends Invocation<IN,OUT>> invocationToken)
ContextInvocation.IN - the input data type.OUT - the output data type.invocationToken - the invocation class token.IllegalArgumentException - if no default constructor was found.@NotNull public <IN,OUT> RoutineBuilder<IN,OUT> with(@NotNull ClassToken<? extends Invocation<IN,OUT>> invocationToken, @Nullable Object... args)
ContextInvocation.IN - the input data type.OUT - the output data type.invocationToken - the invocation class token.args - the invocation constructor arguments.IllegalArgumentException - if no constructor taking the specified objects
as parameters was found.@NotNull public <IN,OUT> RoutineBuilder<IN,OUT> with(@NotNull Invocation<IN,OUT> invocation)
ContextInvocation.IN - the input data type.OUT - the output data type.invocation - the invocation instance.IllegalArgumentException - if the class of the specified invocation has
not a static scope or no default construct is
found.@NotNull public <IN,OUT> RoutineBuilder<IN,OUT> with(@NotNull Invocation<IN,OUT> invocation, @Nullable Object... args)
ContextInvocation.IN - the input data type.OUT - the output data type.invocation - the invocation instance.args - the invocation constructor arguments.IllegalArgumentException - if the class of the specified invocation has
not a static scope or no default construct is
found.@NotNull public ServiceObjectProxyRoutineBuilder with(@NotNull ContextInvocationTarget<?> target)
FactoryContext as the routine
Service.
Note that the built routine results will be dispatched into the configured Looper, thus,
waiting for the outputs on the very same Looper thread, immediately after its invocation,
will result in a deadlock. By default output results are dispatched in the main Looper.
Note also that the invocation input data will be cached, and the results will be produced
only after the invocation channel is closed, so be sure to avoid streaming inputs in order to
prevent starvation or out of memory errors.
target - the invocation target.@NotNull public <IN,OUT> ServiceRoutineBuilder<IN,OUT> with(@NotNull TargetInvocationFactory<IN,OUT> target)
getInvocationFactory(Class, Object...) of the routine Service.
Note that the built routine results will be dispatched into the configured Looper, thus, waiting for the outputs on the very same Looper thread, immediately after its invocation, will result in a deadlock. By default output results are dispatched in the main Looper.
IN - the input data type.OUT - the output data type.target - the invocation target.@NotNull public ServiceObjectProxyRoutineBuilder withClassOfType(@NotNull Class<?> targetClass)
FactoryContext as the routine
Service.
Note that the built routine results will be always dispatched on the configured Looper thread, thus waiting for the outputs immediately after its invocation may result in a deadlock.
targetClass - the invocation target class.@NotNull public ServiceObjectProxyRoutineBuilder withInstanceOf(@NotNull Class<?> targetClass)
FactoryContext as the routine
Service.
Note that the built routine results will be always dispatched on the configured Looper thread, thus waiting for the outputs immediately after its invocation may result in a deadlock.
targetClass - the class of the invocation target.@NotNull public ServiceObjectProxyRoutineBuilder withInstanceOf(@NotNull Class<?> targetClass, @Nullable Object... factoryArgs)
FactoryContext as the routine
Service.
Note that the built routine results will be always dispatched on the configured Looper thread, thus waiting for the outputs immediately after its invocation may result in a deadlock.
targetClass - the class of the invocation target.factoryArgs - the object factory arguments.