org.szegedi.spring.web.jsflow.support
Interface FlowStateIdGenerator

All Known Implementing Classes:
RandomFlowStateIdGenerator

public interface FlowStateIdGenerator

An interface for objects that generate flow state IDs. Might be used by various FlowStateStorage implementations.

Version:
$Id: $
Author:
Attila Szegedi

Method Summary
 boolean dependsOnContinuation()
          Returns true if the return value of generateStateId(NativeContinuation) depends on the passed state (that is, for a given state object, it will always return the same ID).
 java.lang.Long generateStateId(org.mozilla.javascript.NativeContinuation state)
          Generate the flow state id for the specified state.
 

Method Detail

generateStateId

java.lang.Long generateStateId(org.mozilla.javascript.NativeContinuation state)
Generate the flow state id for the specified state.

Parameters:
state -
Returns:
the new ID. Must not be negative.

dependsOnContinuation

boolean dependsOnContinuation()
Returns true if the return value of generateStateId(NativeContinuation) depends on the passed state (that is, for a given state object, it will always return the same ID). Implementations of the interface that implement counters or random generators will return false. Implementations that use some information contained in the continuation will return true. If an implementation returns true, then returning an ID equal to an existing state's ID might cause the user of the class to overwrite the existing ID. If an implementation returns false, the user of the class is encouraged to invoke the generateStateId(NativeContinuation) method repeatedly until it receives a non-conflicting ID.

Returns:
whether this generator generates IDs that depend on the state.