|
||||||||||
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 CacheLoader attribute. |
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 Attributes
public boolean equals(Object arg0)
equals
in class Object
public long getCreateTime()
getCreateTime
in interface Attributes
public long getDefaultTimeToLive()
getDefaultTimeToLive
in interface Attributes
public long getIdleTime()
getIdleTime
in interface Attributes
public CacheEventListener getListener()
getListener
in interface Attributes
public CacheLoader getLoader()
CacheLoader
attribute.
getLoader
in interface Attributes
CacheLoader
attribute.public int getSize()
setSize(int)
method, or in the case of StreamAccess objects, the
size is calculated by the cache.
getSize
in interface Attributes
public long getTimeToLive()
getTimeToLive
in interface Attributes
public long getVersion()
getVersion
in interface Attributes
public boolean isSet(long theFlags)
isSet
in interface Attributes
theFlags
- 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 Attributes
public void setCreateTime(long aCreateTime)
setCreateTime
in interface Attributes
aCreateTime
- The createTime to setpublic void setDefaultTimeToLive(long ttl) throws InvalidArgumentException
CacheLoader
objector 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 Attributes
ttl
- 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)
Attributes
class.
setFlags
in interface Attributes
theFlags
- 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 Attributes
idle
- 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 Attributes
event
- The event to listen for.aListener
- the listener to fire when the event occurs.public void setLoader(CacheLoader aLoader)
setLoader
in interface Attributes
aLoader
- The loader to set. This parameter can be null.public void setSize(int aSize)
setSize
in interface Attributes
aSize
- the size to be set. if this parameter is smaller than zero,
this method silently returns.public void setTimeToLive(long ttl) throws InvalidArgumentException
CacheLoader
object 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 Attributes
ttl
- 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 Attributes
aVersion
- the version number to set.public long timeToSeconds(int days, int hours, int minutes, int seconds) throws InvalidArgumentException
timeToSeconds
in interface Attributes
days
- 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 |