public class StateMachineProxyBuilder
extends java.lang.Object
StateMachine.| Modifier and Type | Class and Description |
|---|---|
private static class |
StateMachineProxyBuilder.MethodInvocationHandler |
| Modifier and Type | Field and Description |
|---|---|
private StateContextLookup |
contextLookup |
private java.lang.ClassLoader |
defaultCl |
private static java.lang.Object[] |
EMPTY_ARGUMENTS |
private EventFactory |
eventFactory |
private boolean |
ignoreStateContextLookupFailure |
private boolean |
ignoreUnhandledEvents |
private EventArgumentsInterceptor |
interceptor |
private static org.slf4j.Logger |
log |
private java.lang.String |
name |
| Constructor and Description |
|---|
StateMachineProxyBuilder() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
create(java.lang.Class<?>[] ifaces,
StateMachine sm)
Creates a proxy for the specified interfaces and which uses the specified
StateMachine. |
<T> T |
create(java.lang.Class<T> iface,
StateMachine sm)
Creates a proxy for the specified interface and which uses the specified
StateMachine. |
StateMachineProxyBuilder |
setClassLoader(java.lang.ClassLoader cl)
Sets the class loader to use for instantiating proxies.
|
StateMachineProxyBuilder |
setEventArgumentsInterceptor(EventArgumentsInterceptor interceptor)
Sets the
EventArgumentsInterceptor to be used. |
StateMachineProxyBuilder |
setEventFactory(EventFactory eventFactory)
Sets the
EventFactory to be used. |
StateMachineProxyBuilder |
setIgnoreStateContextLookupFailure(boolean b)
Sets whether the failure to lookup a
StateContext corresponding
to a method call on the proxy produced by this builder will raise an
exception or be silently ignored. |
StateMachineProxyBuilder |
setIgnoreUnhandledEvents(boolean b)
Sets whether events which have no handler in the current state will raise
an exception or be silently ignored.
|
StateMachineProxyBuilder |
setName(java.lang.String name)
Sets the name of the proxy created by this builder.
|
StateMachineProxyBuilder |
setStateContextLookup(StateContextLookup contextLookup)
Sets the
StateContextLookup to be used. |
private static final org.slf4j.Logger log
private static final java.lang.Object[] EMPTY_ARGUMENTS
private StateContextLookup contextLookup
private EventFactory eventFactory
private EventArgumentsInterceptor interceptor
private boolean ignoreUnhandledEvents
private boolean ignoreStateContextLookupFailure
private java.lang.String name
private java.lang.ClassLoader defaultCl
public StateMachineProxyBuilder setName(java.lang.String name)
toString() method. If not specified a default
auto generated name will be used.name - the name.StateMachineProxyBuilder for method chaining.public StateMachineProxyBuilder setStateContextLookup(StateContextLookup contextLookup)
StateContextLookup to be used. The default is to use
a SingletonStateContextLookup.contextLookup - the StateContextLookup to use.StateMachineProxyBuilder for method chaining.public StateMachineProxyBuilder setEventFactory(EventFactory eventFactory)
EventFactory to be used. The default is to use a
DefaultEventFactory.eventFactory - the EventFactory to use.StateMachineProxyBuilder for method chaining.public StateMachineProxyBuilder setEventArgumentsInterceptor(EventArgumentsInterceptor interceptor)
EventArgumentsInterceptor to be used. By default no
EventArgumentsInterceptor will be used.interceptor - the EventArgumentsInterceptor to use.StateMachineProxyBuilder for method chaining.public StateMachineProxyBuilder setIgnoreUnhandledEvents(boolean b)
b - true to ignore context lookup failures.StateMachineProxyBuilder for method chaining.public StateMachineProxyBuilder setIgnoreStateContextLookupFailure(boolean b)
StateContext corresponding
to a method call on the proxy produced by this builder will raise an
exception or be silently ignored. The default is to raise an exception.b - true to ignore context lookup failures.StateMachineProxyBuilder for method chaining.public StateMachineProxyBuilder setClassLoader(java.lang.ClassLoader cl)
ClassLoader as returned by
Thread.getContextClassLoader().cl - the class loaderStateMachineProxyBuilder for method chaining.public <T> T create(java.lang.Class<T> iface,
StateMachine sm)
StateMachine.iface - the interface the proxy will implement.sm - the StateMachine which will receive the events
generated by the method calls on the proxy.public java.lang.Object create(java.lang.Class<?>[] ifaces,
StateMachine sm)
StateMachine.ifaces - the interfaces the proxy will implement.sm - the StateMachine which will receive the events
generated by the method calls on the proxy.