Class AbstractSessionPersistentFieldStrategy
java.lang.Object
org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy
- All Implemented Interfaces:
PersistentFieldStrategy
- Direct Known Subclasses:
EntityPersistentFieldStrategy
,EntityPersistentFieldStrategy
,FlashPersistentFieldStrategy
,SessionPersistentFieldStrategy
public abstract class AbstractSessionPersistentFieldStrategy
extends Object
implements PersistentFieldStrategy
Base class for strategies that store their values as keys in the session. Implements a uniform format for the keys,
based on a prefix to identify the particular strategy.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractSessionPersistentFieldStrategy
(String prefix, Request request) -
Method Summary
Modifier and TypeMethodDescriptionconvertApplicationValueToPersisted
(Object newValue) Hook that allows a value to be converted as it is written to the session.convertPersistedToApplicationValue
(Object persistedValue) Converts a persisted value stored in the session back into an application value.protected void
didReadChange
(Session session, String attributeName) Called after each key is read bygatherFieldChanges(String)
.void
discardChanges
(String pageName) Discards any saved changes for the name page.final Collection<PersistentFieldChange>
gatherFieldChanges
(String pageName) Finds all persistent changes previously stored for the named page (for the current active session or client).final void
postChange
(String pageName, String componentId, String fieldName, Object newValue) Posts a change of a persistent property.
-
Constructor Details
-
AbstractSessionPersistentFieldStrategy
-
-
Method Details
-
gatherFieldChanges
Description copied from interface:PersistentFieldStrategy
Finds all persistent changes previously stored for the named page (for the current active session or client).- Specified by:
gatherFieldChanges
in interfacePersistentFieldStrategy
-
discardChanges
Description copied from interface:PersistentFieldStrategy
Discards any saved changes for the name page. There is no expectation that data already gathered from the strategy and presumably dumped into component instance fields will be affected, but future field access (within this request or a later one) will show no data for the indicated page.- Specified by:
discardChanges
in interfacePersistentFieldStrategy
- Parameters:
pageName
- logical name of page whose field persistent data should be discarded
-
didReadChange
Called after each key is read bygatherFieldChanges(String)
. This implementation does nothing, subclasses may override.- Parameters:
session
- the session from which a value was just readattributeName
- the name of the attribute used to read a value
-
postChange
public final void postChange(String pageName, String componentId, String fieldName, Object newValue) Description copied from interface:PersistentFieldStrategy
Posts a change of a persistent property.- Specified by:
postChange
in interfacePersistentFieldStrategy
- Parameters:
pageName
- the name of the page containing the componentcomponentId
- the nested id path of the component (or null for the page's root component)fieldName
- the name of the field whose persistent value has changednewValue
- the new value for the field, possibly null
-
convertApplicationValueToPersisted
Hook that allows a value to be converted as it is written to the session. Passed the new value provided by the application, returns the object to be stored in the session. This implementation simply returns the provided value.- Parameters:
newValue
- non-null value- Returns:
- persisted value
- See Also:
-
convertPersistedToApplicationValue
Converts a persisted value stored in the session back into an application value. This implementation returns the persisted value as is.- Parameters:
persistedValue
- non-null persisted value- Returns:
- application value
- See Also:
-