Home » tapestry-src-5.0.19 » org.apache.tapestry5 » [javadoc | source]
public interface: PrimaryKeyEncoder [javadoc | source]

All Known Implementing Classes:

Used by org.apache.tapestry5.corelib.components.Loop , org.apache.tapestry5.corelib.components.AjaxFormLoop 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.

The org.apache.tapestry5.util.DefaultPrimaryKeyEncoder implementation is used in most circumstances.

Method from org.apache.tapestry5.PrimaryKeyEncoder Summary:
prepareForKeys,   toKey,   toValue
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 equivalent object.