Class SingletonStateContextLookup
- java.lang.Object
-
- org.apache.mina.statemachine.context.SingletonStateContextLookup
-
- All Implemented Interfaces:
StateContextLookup
public class SingletonStateContextLookup extends java.lang.Object implements StateContextLookup
StateContextLookupimplementation which always returns the sameStateContextinstance.
-
-
Field Summary
Fields Modifier and Type Field Description private StateContextcontext
-
Constructor Summary
Constructors Constructor Description SingletonStateContextLookup()Creates a new instance which always returns the sameDefaultStateContextinstance.SingletonStateContextLookup(StateContextFactory contextFactory)Creates a new instance which uses the specifiedStateContextFactoryto create the single instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateContextlookup(java.lang.Object[] eventArgs)Searches the arguments from anEventand returns aStateContextif any of the arguments holds one.
-
-
-
Field Detail
-
context
private final StateContext context
-
-
Constructor Detail
-
SingletonStateContextLookup
public SingletonStateContextLookup()
Creates a new instance which always returns the sameDefaultStateContextinstance.
-
SingletonStateContextLookup
public SingletonStateContextLookup(StateContextFactory contextFactory)
Creates a new instance which uses the specifiedStateContextFactoryto create the single instance.- Parameters:
contextFactory- theStateContextFactoryto use to create the singleton instance.
-
-
Method Detail
-
lookup
public StateContext lookup(java.lang.Object[] eventArgs)
Description copied from interface:StateContextLookupSearches the arguments from anEventand returns aStateContextif any of the arguments holds one. NOTE! This method must create a newStateContextif a compatible object is in the arguments and the next time that same object is passed to this method the sameStateContextshould be returned.- Specified by:
lookupin interfaceStateContextLookup- Parameters:
eventArgs- The arguments we are looking for- Returns:
- The StateContext we are looking for
-
-