Class AbstractStateContextLookup

  • All Implemented Interfaces:
    StateContextLookup
    Direct Known Subclasses:
    IoSessionStateContextLookup

    public abstract class AbstractStateContextLookup
    extends java.lang.Object
    implements StateContextLookup
    Abstract StateContextLookup implementation. The lookup(Object[]) method will loop through the event arguments and call the supports(Class) method for each of them. The first argument that this method returns true for will be passed to the abstract lookup(Object) method which should try to extract a StateContext from the argument. If none is found a new StateContext will be created and stored in the event argument using the store(Object, StateContext) method.
    • Constructor Detail

    • Method Detail

      • lookup

        public StateContext lookup​(java.lang.Object[] eventArgs)
        Description copied from interface: StateContextLookup
        Searches the arguments from an Event and returns a StateContext if any of the arguments holds one. NOTE! This method must create a new StateContext if a compatible object is in the arguments and the next time that same object is passed to this method the same StateContext should be returned.
        Specified by:
        lookup in interface StateContextLookup
        Parameters:
        eventArgs - The arguments we are looking for
        Returns:
        The StateContext we are looking for
      • lookup

        protected abstract StateContext lookup​(java.lang.Object eventArg)
        Extracts a StateContext from the specified event argument which is an instance of a class supports(Class) returns true for.
        Parameters:
        eventArg - the event argument.
        Returns:
        the StateContext.
      • store

        protected abstract void store​(java.lang.Object eventArg,
                                      StateContext context)
        Stores a new StateContext in the specified event argument which is an instance of a class supports(Class) returns true for.
        Parameters:
        eventArg - the event argument.
        context - the StateContext to be stored.
      • supports

        protected abstract boolean supports​(java.lang.Class<?> c)
        Must return true for any Class that this StateContextLookup can use to store and lookup StateContext objects.
        Parameters:
        c - the class.
        Returns:
        true or false.