org.apache.tapestry5
Interface PrimaryKeyEncoder<K extends Serializable,V>

Type Parameters:
K - the type of the primary key, used to identify the value (which must be serializable)
V - the type of value identified by the key
All Known Implementing Classes:
DefaultPrimaryKeyEncoder

Deprecated. This interface overlaps with ValueEncoder and has been deprecated in release 5.1. The interface itself will be removed in a later release of Tapestry. The components that used this interface (AjaxFormLoop, Grid, GridRows and Loop) have been changed to expect ValueEncoder instead, and an automatic coercion from PrimaryKeyEncoder to ValueEncoder has been provided.

public interface PrimaryKeyEncoder<K extends Serializable,V>

Used by Loop, 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 DefaultPrimaryKeyEncoder implementation is used in most circumstances.

See Also:
ValueEncoder

Method Summary
 Class<K> getKeyType()
          Deprecated. Returns the type of key.
 void prepareForKeys(List<K> keys)
          Deprecated. Invoked as part of a form submission to alert the encoder that a series of keys may be converted back to values.
 K toKey(V value)
          Deprecated. Given a particular value, this method extracts and returns the primary key that identifies the value.
 V toValue(K key)
          Deprecated. For a particular primary key, previously obtained via toKey(Object), this method returns the same or equivalent object.
 

Method Detail

toKey

K toKey(V value)
Deprecated. 
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).

Parameters:
value - whose primary key is needed
Returns:
the key for the value

prepareForKeys

void prepareForKeys(List<K> keys)
Deprecated. 
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.


toValue

V toValue(K key)
Deprecated. 
For a particular primary key, previously obtained via toKey(Object), this method returns the same or equivalent object.

Parameters:
key - used to identify the object
Returns:
the value object for the key

getKeyType

Class<K> getKeyType()
Deprecated. 
Returns the type of key. This is primarily used when Tapestry must convert an existing PrimaryKeyConverter into a ValueEncoder.

Returns:
key type or null if not known
Since:
5.1.0.0


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.