|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlbg.protocol.data.Metadata<K>
K
- The type of the entry keypublic class Metadata<K>
Denotes metadata about a cache entry.
An entry is typically represented by an ID, and has an insertion time and a
size. While these metrics are often used, it wouldn't be possible to foresee
every other metric that could possibly be used, or every side data that could
be needed. For this reason, the setExtra(String, Object)
and
getExtra(String)
methods offer a contract similar to
Map
to set what could be needed.
Field Summary | |
---|---|
K |
id
|
Constructor Summary | |
---|---|
Metadata(K id)
Creates a Metada, setting time to the current time. |
Method Summary | |
---|---|
java.lang.Object |
getExtra(java.lang.String key)
|
long |
getTime()
|
long |
getWeight()
|
java.lang.Object |
setExtra(java.lang.String key,
java.lang.Object value)
|
void |
setTime()
Set the time from epoch. |
void |
setTime(long time)
Sets the creation time of this Metadata. |
void |
setWeight(long weight)
Sets the weight of this metadata. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final K id
Constructor Detail |
---|
public Metadata(K id)
setWeight(long)
,
setTime(long)
Method Detail |
---|
public void setTime()
setTime(long)
public void setTime(long time)
System.currentTimeMillis()
but can very well be any other
convention as long as it is consistent.
time
- The time in millisecondspublic long getTime()
public void setWeight(long weight)
weight
- The weight to set.public long getWeight()
public java.lang.Object setExtra(java.lang.String key, java.lang.Object value)
public java.lang.Object getExtra(java.lang.String key)
|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.