|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object texsoft.java.object.XsObjectWithReflection texsoft.java.object.XsObjectSerializable texsoft.java.object.XsObjectWithKey
This class adds key support to XsObjectSerializable
.
The queryKeyClass()
function must be everriden into derived classes to
return the Class object for the XsKeyObject
's derived class that is key for
this class.
The readKey()
method returns a new key whose properties are set from this object.
The writeKey(XsKeyObject)
methods, given a key object, set this object properties from the key.
The createKey()
method return a new key empty.
Moreover, this class implements the Comparable interface, that allow ordering and searching of instances of this class based on object key. The object can be compared to another object of the same type or to a key of the object. In both case ordering is based on the key. The key object of the class must have set in its constructor the ordering of the properties (if there are multiple properties in the key and their order is significative for comparison). If the key has only one property it is not needed.
If an ordering other than that imposed by the key is needed a XsObjectComparator
can be created listing the properties on which sorting has to be done, and
used in sorting/searching Collections funcions.
Constructor Summary | |
XsObjectWithKey()
Creates a new XsObjectWithKey instance. |
|
XsObjectWithKey(java.lang.Class iface)
Creates new XsObjectWithKey with given interface filter. |
|
XsObjectWithKey(java.lang.String ser)
Creates a new XsObjectWithKey object and initializes it with the serialized string passed as argument. |
Method Summary | |
int |
compareTo(java.lang.Object obj)
Compares to an object of the same type or a to key object for this class. |
XsKeyObject |
createKey()
Returns a new instance of the key class for this class. |
abstract java.lang.Class |
queryKeyClass()
Returns a Class object of the key class for this class. |
XsKeyObject |
readKey()
Returns a key object with key properties set from this object. |
XsObjectWithKey |
writeKey(XsKeyObject key)
Valorizes key properties of this object from the key object passed. |
Methods inherited from class texsoft.java.object.XsObjectSerializable |
deserialize, serialize |
Methods inherited from class texsoft.java.object.XsObjectWithReflection |
applyInterfaceFilter, applyInterfaceFilter, doGet, doNew, doSet, doSet, doSet, doSet, doSet, doSet, doSet, doSet, doSet, inspect, removeInterfaceFilter, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XsObjectWithKey() throws XsObjectException
XsObjectException
- thrown if a problem occurs while obtaining the inspector for the class.XsObjectWithReflection.XsObjectWithReflection()
public XsObjectWithKey(java.lang.Class iface) throws XsObjectException
iface
- class corresponding to an interface implemented by this class used as a filter
for properties accessible with inspection methods.
XsObjectException
- thrown if a problem occurs while obtaining the inspector for the class.XsObjectWithReflection.XsObjectWithReflection(Class)
public XsObjectWithKey(java.lang.String ser) throws XsObjectException
The passed String is supposed to be created by a XsObjectSerializable.serialize()
method called on a object of the same type of the this.
ser
- serialized rapresentation of an object of this class.
XsObjectException
- thrown if an error occurs during deserialization of the string.XsObjectSerializable.XsObjectSerializable(String)
Method Detail |
public abstract java.lang.Class queryKeyClass()
Must be implemented in derived classes to define the key type for the class.
public final XsKeyObject createKey() throws XsObjectException
XsObjectException
- thrown if a error occurs creating the key object.public final XsKeyObject readKey() throws XsObjectException
XsObjectException
- thrown if a error occurs creating the key object.public final XsObjectWithKey writeKey(XsKeyObject key) throws XsObjectException
key
- key object for this class.
XsObjectException
- thrown if a error occurs setting the object's properties.public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
obj
- object to be compared to this instance. This argument can be either another instance
of this class or an instance of the key class of this class. So the object can
be compared to another object or to a key.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |