public interface: PrimaryKeyEncoder
All Known Implementing Classes:
Used by org.apache.tapestry5.corelib.components.Loop
and similar components to extract out an identifier, here termed a "primary key", that can be stored on the client
and later used to recover the same, or equivalent, server side object.
implementation is used in most circumstances.
- the type of the primary key, used to identify the value (which must be serializable)
- Also see:
- the type of value identified by the key
|Method from org.apache.tapestry5.PrimaryKeyEncoder Detail:|
public void prepareForKeys(List<K> keys)
Invoked as part of a form submission to alert the encoder that a series of keys may be converted back to values.
This is advisory only, and the keys passed to #toValue(Serializable) may not include all keys in the
list, or may include keys not in the list. In general, though, the keys passed in will match the actual keys to
be converted, giving the encoder a chance to efficiently fetch the necessary value objects as a group.
public K toKey(V value)
Given a particular value, this method extracts and returns the primary key that identifies the value. The key
will later be converted back into a value using #toValue(Serializable) .
public V toValue(K key)
For a particular primary key, previously obtained via #toKey(Object) , this method returns the same or