org.omnifaces.component.output.cache
Class CacheEntry

java.lang.Object
  extended by org.omnifaces.component.output.cache.CacheEntry
All Implemented Interfaces:
java.io.Serializable

public class CacheEntry
extends java.lang.Object
implements java.io.Serializable

Meta data for a value that's stored in a cache. Can be used for cache implementations that don't support both validity and attributes natively. Cache implementations are not required to use this type.

Since:
1.1
Author:
Arjan Tijms
See Also:
Serialized Form

Constructor Summary
CacheEntry(java.lang.String value, java.util.Date validTill)
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getAttributes()
          Gets a map of attributes associated with this entry.
 java.util.Date getValidTill()
          Returns the date that's the last moment in time the value obtained via getValue() is valid.
 java.lang.String getValue()
          Returns the value for which this object is keeping meta data
 boolean isValid()
          Returns whether this entry holds a valid value.
 void setValidTill(java.util.Date validTill)
          Sets the date that's the last moment in time the value obtained via getValue() is valid.
 void setValue(java.lang.String value)
          Sets the value for which this object is keeping meta data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheEntry

public CacheEntry(java.lang.String value,
                  java.util.Date validTill)
Method Detail

getValue

public java.lang.String getValue()
Returns the value for which this object is keeping meta data

Returns:
The value for which meta data is kept

setValue

public void setValue(java.lang.String value)
Sets the value for which this object is keeping meta data

Parameters:
value - The value for which meta data is kept

getValidTill

public java.util.Date getValidTill()
Returns the date that's the last moment in time the value obtained via getValue() is valid. After that moment, the value should not be used.

Returns:
date indicating last moment value hold by this object is valid.

setValidTill

public void setValidTill(java.util.Date validTill)
Sets the date that's the last moment in time the value obtained via getValue() is valid. After that moment, the value should not be used.

Parameters:
validTill - date indicating last moment value hold by this object is valid.
Since:
1.2

isValid

public boolean isValid()
Returns whether this entry holds a valid value. If false is returned, the value should not be used and the cache implementation should try to remove this entry and its associated value from the cache.

Returns:
true if this entry is still valid, false otherwise.

getAttributes

public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Gets a map of attributes associated with this entry.

Attributes are general key,value pairs, that are currently mainly used to store the result of EL expressions that appear in the rendering represented by the main value this entry represents.

Returns:
a map of attributes associated with this entry.
Since:
1.2