|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jstore.BasicStorable
public class BasicStorable
This class is a convenient super class for any Storable classes. It gets and sets all (non transient) attributs by introspection. It provides getter/setter for store, cdate and mdate. It encapsulated the store id of the object.
Nested Class Summary | |
---|---|
static class |
BasicStorable.CdateComparator<T extends Storable>
Compares two Storables using their Cdate in descending order (newest date first). |
static class |
BasicStorable.IdComparator<T extends Storable>
Compares two Storables using their ID. |
static class |
BasicStorable.MdateComparator<T extends Storable>
Compares two Storables using their Mdate in descending order (newest date first). |
Field Summary | |
---|---|
protected Date |
cdate
|
protected Date |
ddate
|
protected String |
id
|
protected Date |
mdate
|
static String |
REVISION
|
protected Store |
store
|
Constructor Summary | |
---|---|
BasicStorable()
Creates a new BasicStorable |
|
BasicStorable(BasicStorable other)
Creates a new BasicStorable by cloning |
Method Summary | ||
---|---|---|
void |
clearId()
Clear the ID of this storable. |
|
Object |
clone()
|
|
int |
compareTo(BasicStorable other)
|
|
boolean |
equals(Object obj)
|
|
String |
getAttribute(Object attVal)
Returns a persistent representation of an attribute from its name |
|
Map<String,String> |
getAttributes()
Returns a map containing all the attributs of this Storable |
|
Date |
getCdate()
Get the value of cdate. |
|
static
|
getCdateComparator()
|
|
Date |
getDdate()
Returns the delete date of this storable. |
|
String |
getId()
Get the value of id. |
|
static
|
getIdComparator()
|
|
Date |
getMdate()
Get the value of mdate. |
|
static
|
getMdateComparator()
|
|
Store |
getStore()
Get the value of store. |
|
String |
getUrid()
Returns the URID where this Storable has been created (ie return the urid of this id). |
|
boolean |
hasBeenUpdated()
Check if this storable has been updated |
|
int |
hashCode()
This method return the HashCode of a storable using the storable id's hashcode if id is not null. |
|
boolean |
isStored()
Check if this storable is registered in the store. |
|
String |
resolveAtt(Object attVal)
This method is called if the type was not resolved by the getAttribute method |
|
Object |
resolveVal(Class<?> classType,
String persistentValue)
This method is called if the type was not resolved by the getValue method |
|
void |
setAttributes(Map<String,String> attributes)
Storable attributes setter |
|
void |
setCdate(Date v)
Set the value of cdate. |
|
void |
setDdate(Date ddate)
Sets the delete date of this storable. |
|
void |
setId(String v)
Set the value of id. |
|
void |
setMdate(Date v)
Set the value of mdate. |
|
void |
setStore(Store v)
Set the value of store. |
|
String |
toXml()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
protected Date cdate
protected Date mdate
protected transient String id
protected transient Store store
protected transient Date ddate
Constructor Detail |
---|
public BasicStorable()
public BasicStorable(BasicStorable other)
other
- the BasicStorable to cloneMethod Detail |
---|
public String toXml()
public int hashCode()
hashCode
in class Object
public static <T extends Storable> Comparator<T> getIdComparator()
public static <T extends Storable> Comparator<T> getCdateComparator()
public static <T extends Storable> Comparator<T> getMdateComparator()
public void setAttributes(Map<String,String> attributes)
setAttributes
in interface Storable
attributes
- the attributes to set:public Map<String,String> getAttributes()
getAttributes
in interface Storable
public String getAttribute(Object attVal)
getAttribute
in interface Storable
attVal
- the attribute value
public String resolveAtt(Object attVal)
resolveAtt
in interface Storable
attVal
- the attribute value
public Object resolveVal(Class<?> classType, String persistentValue)
resolveVal
in interface Storable
classType
- the class typepersistentValue
- the persistent value
public Object clone()
clone
in interface Storable
clone
in class Object
public void clearId()
public boolean hasBeenUpdated()
public String getUrid()
public boolean isStored()
public int compareTo(BasicStorable other)
compareTo
in interface Comparable<BasicStorable>
public boolean equals(Object obj)
equals
in class Object
public String getId()
getId
in interface Storable
public void setId(String v)
setId
in interface Storable
v
- Value to assign to id.public Store getStore()
getStore
in interface Storable
public void setStore(Store v)
setStore
in interface Storable
v
- Value to assign to store.public Date getCdate()
getCdate
in interface Storable
public void setCdate(Date v)
setCdate
in interface Storable
v
- Value to assign to cdate.public Date getMdate()
getMdate
in interface Storable
public void setMdate(Date v)
setMdate
in interface Storable
v
- Value to assign to mdate.public Date getDdate()
getDdate
in interface Storable
public void setDdate(Date ddate)
setDdate
in interface Storable
ddate
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |