org.xmpp.util
Class ValueWrapper<V>

java.lang.Object
  extended by org.xmpp.util.ValueWrapper<V>
All Implemented Interfaces:
java.io.Serializable

@Immutable
public class ValueWrapper<V>
extends java.lang.Object
implements java.io.Serializable

A wrapper implementation for cached values, suitable for Map based caches where a significant portion of keys matches the corresponding value exactly.

Author:
Guus der Kinderen, guus.der.kinderen@gmail.com
See Also:
Serialized Form

Nested Class Summary
static class ValueWrapper.Representation
          Indication of how the key of this cache entry represents the cache value.
 
Constructor Summary
ValueWrapper(V value)
          Wraps a value while using the USE_VALUE representation.
ValueWrapper(ValueWrapper.Representation representation)
          Constructs an empty wrapper.
 
Method Summary
 ValueWrapper.Representation getRepresentation()
           
 V getValue()
          Returns the wrapped value, or null if the representation used in this instance is not USE_VALUE;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueWrapper

public ValueWrapper(ValueWrapper.Representation representation)
Constructs an empty wrapper. This wrapper either is used to indicate that the key that maps to this value: cannot be used to generate a valid value, or, is an exact duplicate of the generated value. An IllegalArgumentException is thrown if the argument is USE_VALUE.

Parameters:
representation - Key representation indicator.

ValueWrapper

public ValueWrapper(V value)
Wraps a value while using the USE_VALUE representation.

Parameters:
value - The value that is wrapped.
Method Detail

getValue

public V getValue()
Returns the wrapped value, or null if the representation used in this instance is not USE_VALUE;

Returns:
the wrapped value.

getRepresentation

public ValueWrapper.Representation getRepresentation()


Copyright © 2009-2010 Ignite Realtime. All Rights Reserved.