Class StateMachineProxyBuilder
java.lang.Object
org.apache.mina.statemachine.StateMachineProxyBuilder
Used to create proxies which will forward all method calls on them to a
StateMachine.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StateContextLookupprivate ClassLoaderprivate static final Object[]private EventFactoryprivate booleanprivate booleanprivate EventArgumentsInterceptorprivate static final org.slf4j.Loggerprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(Class<?>[] ifaces, StateMachine sm) Creates a proxy for the specified interfaces and which uses the specifiedStateMachine.<T> Tcreate(Class<T> iface, StateMachine sm) Creates a proxy for the specified interface and which uses the specifiedStateMachine.Sets the class loader to use for instantiating proxies.setEventArgumentsInterceptor(EventArgumentsInterceptor interceptor) Sets theEventArgumentsInterceptorto be used.setEventFactory(EventFactory eventFactory) Sets theEventFactoryto be used.setIgnoreStateContextLookupFailure(boolean b) Sets whether the failure to lookup aStateContextcorresponding to a method call on the proxy produced by this builder will raise an exception or be silently ignored.setIgnoreUnhandledEvents(boolean b) Sets whether events which have no handler in the current state will raise an exception or be silently ignored.Sets the name of the proxy created by this builder.setStateContextLookup(StateContextLookup contextLookup) Sets theStateContextLookupto be used.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
EMPTY_ARGUMENTS
-
contextLookup
-
eventFactory
-
interceptor
-
ignoreUnhandledEvents
private boolean ignoreUnhandledEvents -
ignoreStateContextLookupFailure
private boolean ignoreStateContextLookupFailure -
name
-
defaultCl
-
-
Constructor Details
-
StateMachineProxyBuilder
public StateMachineProxyBuilder()Creates a new StateMachineProxyBuilder instance
-
-
Method Details
-
setName
Sets the name of the proxy created by this builder. This will be used by the proxiestoString()method. If not specified a default auto generated name will be used.- Parameters:
name- the name.- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
setStateContextLookup
Sets theStateContextLookupto be used. The default is to use aSingletonStateContextLookup.- Parameters:
contextLookup- theStateContextLookupto use.- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
setEventFactory
Sets theEventFactoryto be used. The default is to use aDefaultEventFactory.- Parameters:
eventFactory- theEventFactoryto use.- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
setEventArgumentsInterceptor
Sets theEventArgumentsInterceptorto be used. By default noEventArgumentsInterceptorwill be used.- Parameters:
interceptor- theEventArgumentsInterceptorto use.- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
setIgnoreUnhandledEvents
Sets whether events which have no handler in the current state will raise an exception or be silently ignored. The default is to raise an exception.- Parameters:
b-trueto ignore context lookup failures.- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
setIgnoreStateContextLookupFailure
Sets whether the failure to lookup aStateContextcorresponding 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.- Parameters:
b-trueto ignore context lookup failures.- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
setClassLoader
Sets the class loader to use for instantiating proxies. The default is to use the current threads contextClassLoaderas returned byThread.getContextClassLoader().- Parameters:
cl- the class loader- Returns:
- this
StateMachineProxyBuilderfor method chaining.
-
create
Creates a proxy for the specified interface and which uses the specifiedStateMachine.- Type Parameters:
T- The specified interface type- Parameters:
iface- the interface the proxy will implement.sm- theStateMachinewhich will receive the events generated by the method calls on the proxy.- Returns:
- the proxy object.
-
create
Creates a proxy for the specified interfaces and which uses the specifiedStateMachine.- Parameters:
ifaces- the interfaces the proxy will implement.sm- theStateMachinewhich will receive the events generated by the method calls on the proxy.- Returns:
- the proxy object.
-