|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fjank.jcache.AttributesImpl
public final class AttributesImpl
This class defines the attributes an object in the cache can have.
| Field Summary |
|---|
| Fields inherited from interface javax.util.jcache.Attributes |
|---|
DISTRIBUTE, GROUP_TTL_DESTROY, INVALIDATE_EVENT, NOFLUSH, ORIGINAL, REPLY, SPOOL, SYNCHRONIZE |
| Constructor Summary | |
|---|---|
AttributesImpl()
Creates new Attributes |
|
AttributesImpl(Attributes attributes)
|
|
| Method Summary | |
|---|---|
void |
applyAttributes(Attributes attributes)
|
boolean |
equals(Object arg0)
|
long |
getCreateTime()
returns the time the object was loaded into the cache. |
long |
getDefaultTimeToLive()
|
long |
getIdleTime()
returns the current value for the idle time interval. |
CacheEventListener |
getListener()
Gets the CacheEventListener. |
CacheLoader |
getLoader()
returns the CacheLoaderattribute. |
int |
getSize()
returns the size of the object. |
long |
getTimeToLive()
returns the current value for the time to live interval. |
long |
getVersion()
returns the current value of version. |
boolean |
isSet(long theFlags)
Checks wether the flags are set or not. |
void |
reset()
resets the Attributes to its default values. |
void |
setCreateTime(long aCreateTime)
Sets the createTime. |
void |
setDefaultTimeToLive(long ttl)
Will set the maximum time the associated cache object will stay in the cache before it is invalidated. |
void |
setFlags(long theFlags)
Is used to specify wich attributes should be set in the attributes object. |
void |
setIdleTime(long idle)
sets the maximum time the associated cache object will remain in the cache without being referenced before it is invalidated. |
void |
setListener(int event,
CacheEventListener aListener)
Register an event listener object to be executed when the specified event occurs with relationship to the associated object. |
void |
setLoader(CacheLoader aLoader)
Will associate a loader object with this object. |
void |
setSize(int aSize)
Is used to specify the size in bytes of the object being cached. |
void |
setTimeToLive(long ttl)
Will set the maximum time the associated cache object will stay in the cache before it is invalidated. |
void |
setVersion(long aVersion)
Sets the version attribute. |
long |
timeToSeconds(int days,
int hours,
int minutes,
int seconds)
Will convert the time specified into seconds. |
String |
toString()
returns these Attributes as a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AttributesImpl()
public AttributesImpl(Attributes attributes)
| Method Detail |
|---|
public void applyAttributes(Attributes attributes)
applyAttributes in interface Attributespublic boolean equals(Object arg0)
equals in class Objectpublic long getCreateTime()
getCreateTime in interface Attributespublic long getDefaultTimeToLive()
getDefaultTimeToLive in interface Attributespublic long getIdleTime()
getIdleTime in interface Attributespublic CacheEventListener getListener()
getListener in interface Attributespublic CacheLoader getLoader()
CacheLoaderattribute.
getLoader in interface AttributesCacheLoaderattribute.public int getSize()
setSize(int) method, or in the case of StreamAccess objects, the
size is calculated by the cache.
getSize in interface Attributespublic long getTimeToLive()
getTimeToLive in interface Attributespublic long getVersion()
getVersion in interface Attributespublic boolean isSet(long theFlags)
isSet in interface AttributestheFlags - the flags to be checked. may be OR-ed together, for wich this
method will return true only if all flags are set.
public void reset()
reset in interface Attributespublic void setCreateTime(long aCreateTime)
setCreateTime in interface AttributesaCreateTime - The createTime to set
public void setDefaultTimeToLive(long ttl)
throws InvalidArgumentException
CacheLoaderobjector put by the
CacheAccess#replace(Object, Object)) or when the time to live
attribute is set by the
CacheLoader.setAttributes(Object,Attributes) method.
setDefaultTimeToLive in interface Attributesttl - the time to live in seconds. The
timeToSeconds(int, int, int, int) can be used to
convert days, hours, minutes to secounds.
InvalidArgumentException - if a negative value for ttl is supplied.public void setFlags(long theFlags)
Attributesclass.
setFlags in interface AttributestheFlags - The attributes to set. the attributes may be OR-ed together.
I.e. Attributes.DISTRIBUTE | Attributes.SYNCHRONIZE Invalid
flags are silently ignored. To reset all flags you use 0 as a
parameter. I.e. setFlags(0)
public void setIdleTime(long idle)
throws InvalidArgumentException
setIdleTime in interface Attributesidle - is in seconds. The timeToSeconds(int, int, int,int)
can be used to convert days, hours, minutes to secounds.
InvalidArgumentException - if a negative value for idle is supplied.
public void setListener(int event,
CacheEventListener aListener)
setListener in interface Attributesevent - The event to listen for.aListener - the listener to fire when the event occurs.public void setLoader(CacheLoader aLoader)
setLoader in interface AttributesaLoader - The loader to set. This parameter can be null.public void setSize(int aSize)
setSize in interface AttributesaSize - the size to be set. if this parameter is smaller than zero,
this method silently returns.
public void setTimeToLive(long ttl)
throws InvalidArgumentException
CacheLoaderobject or put by the
CacheAccess#replace(Object, Object)) or when the time to live
attribute is set by the
CacheLoader.setAttributes(Object, Attributes) method.
setTimeToLive in interface Attributesttl - the time to live in seconds. The
timeToSeconds(int, int, int, int) can be used to
convert days, hours, minutes to seconds.
InvalidArgumentException - if a negative value for ttl is supplied.public void setVersion(long aVersion)
setVersion in interface AttributesaVersion - the version number to set.
public long timeToSeconds(int days,
int hours,
int minutes,
int seconds)
throws InvalidArgumentException
timeToSeconds in interface Attributesdays - number of days.hours - number of hours.minutes - number of minutes.seconds - number of seconds.
InvalidArgumentException - if any of the parameters are negative values.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||