Package org.xmpp.util
Class ValueWrapper<V extends Serializable>
- java.lang.Object
-
- org.xmpp.util.ValueWrapper<V>
-
- All Implemented Interfaces:
Serializable
@Immutable public class ValueWrapper<V extends Serializable> extends Object implements Serializable
A wrapper implementation for cached values, suitable forMapbased 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
Nested Classes Modifier and Type Class Description static classValueWrapper.RepresentationIndication of how the key of this cache entry represents the cache value.
-
Constructor Summary
Constructors Constructor Description ValueWrapper()Constructs an empty wrapper.ValueWrapper(Exception exception)Constructs a wrapper that is used to indicate that the key that maps to this value cannot be used to generate a valid valueValueWrapper(V value)Wraps a value while using theUSE_VALUErepresentation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetExceptionMessage()Returns the message describing the invalidity of the key that maps to this instance.ValueWrapper.RepresentationgetRepresentation()VgetValue()Returns the wrapped value, ornullif the representation used in this instance is not USE_VALUE;StringtoString()
-
-
-
Constructor Detail
-
ValueWrapper
public ValueWrapper()
Constructs an empty wrapper. This wrapper is used to indicate that the key that maps to this value is an exact duplicate of the generated value.
-
ValueWrapper
public ValueWrapper(Exception exception)
Constructs a wrapper that is used to indicate that the key that maps to this value cannot be used to generate a valid value- Parameters:
exception- Describes the invalidity of the key.
-
ValueWrapper
public ValueWrapper(V value)
Wraps a value while using theUSE_VALUErepresentation.- Parameters:
value- The value that is wrapped.
-
-
Method Detail
-
getValue
public V getValue()
Returns the wrapped value, ornullif the representation used in this instance is not USE_VALUE;- Returns:
- the wrapped value.
-
getRepresentation
public ValueWrapper.Representation getRepresentation()
-
getExceptionMessage
public String getExceptionMessage()
Returns the message describing the invalidity of the key that maps to this instance.- Returns:
- An exception message , possibly null.
-
-