| java.lang.Object org.apache.tapestry.util.DefaultPrimaryKeyEncoder
DefaultPrimaryKeyEncoder | public class DefaultPrimaryKeyEncoder implements PrimaryKeyEncoder<K, V>(Code) | | A default, extensible version of
PrimaryKeyEncoder that is based on loading known values
into an internal map. When there's a reasonable number (hundreds, perhaps thousands) of items to
choose from, and those items are fast and cheap to read and instantiate, this implementation is a
good bet. For very large result sets, you'll need to create your own implementation of
PrimaryKeyEncoder .
< Parameters: K - >the key type (which must be serializable)< Parameters: V - >the value type |
add | final public void add(K key, V value)(Code) | | Adds a new key/value pair to the encoder.
|
getAllValues | final public List<V> getAllValues()(Code) | | |
inKeySet | final protected boolean inKeySet(Set<K> keySet)(Code) | | Returns true if the current key is in the provided set.
Parameters: keySet - the set of keys to check, or null true if the key is in the set, false if it is missing (or if keySet is null) |
isDeleted | final public boolean isDeleted()(Code) | | |
modifyKeySet | final protected Set<K> modifyKeySet(Set<K> keySet, boolean value)(Code) | | Modifies a keySet to add or remove the current key. If necessary, a new Set is created.
Useage:
private Set _myFlagKeys;
public boolean void setMyFlag(boolean value)
{
_myFlagKeys = modifySet(_myFlagKeys, value);
}
Parameters: keySet - the set of keys, or null Parameters: value - true to add the current key, false to remove the provided key set, or a new one |
prepareForKeys | public void prepareForKeys(List<K> keys)(Code) | | Does nothing. Subclasses may override as necessary.
|
provideMissingObject | protected V provideMissingObject(K key)(Code) | | Invoked by
DefaultPrimaryKeyEncoder.toValue(Serializable) whenever a key can not be converted to a value
using the internal cache. This is an opportunity to record the fact that an error occured
(they key was not valuable, possibly because it points to a deleted entity object) and
provide a temporary object. This method may return null, but in a typical application, that
will likely case NullPointerExceptions further down the processing chain.
This implementation returns null, and is intended to be overriden in subclasses.
Parameters: key - key for which a value is required a substitute value, or null |
setDeleted | final public void setDeleted(boolean value)(Code) | | |
toValue | final public V toValue(K key)(Code) | | |
valuesNotInKeySet | final protected List<V> valuesNotInKeySet(Set<K> keySet)(Code) | | Returns a list of all the values except those values whose keys are in the
provided set. The set may be null, in which case all values are returned.
Parameters: keySet - set of keys identifying values to exclude, or null to exclude no values values (not in the set) in order origionally added |
|
|