|
|||||||||
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
Defines an object able to serialize it state, using XsObjectWithReflection
services,
into a String and to init itself from a previously serialized string.
Only read/write properties are processed by the serialization process.
The serialize()
method return a String rappresentation of object's properties.
Only those object's properties that are publicly readable are serialized.
The deserialize(String)
method set the object properties reading them from the
serialized string passed as argument.
If a property is a serializable object itself it is correctly managed during
serialization and deserialization (deserialization is managed by the
special case of String setter of XsClassInspector
).
Special characters are converted in both ways using a java unicode like rappresentatio.
XsObjectWithReflection
Constructor Summary | |
XsObjectSerializable()
Creates a new XsObjectSerializable instance. |
|
XsObjectSerializable(java.lang.Class iface)
Creates new XsObjectSerializable with given interface filter. |
|
XsObjectSerializable(java.lang.String ser)
Creates a new XsObjectSerializable object and initializes it with the serialized string passed as argument. |
Method Summary | |
XsObjectSerializable |
deserialize(java.lang.String s)
Given an input string in the format used by serialize() , sets
the object's properties. |
java.lang.String |
serialize()
Serialize the object's properties in a format that can be used by the string constructor and deserialize(String) to recreate the object contents. |
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 XsObjectSerializable() throws XsObjectException
XsObjectException
- thrown if a problem occurs while obtaining the inspector for the class.XsObjectWithReflection.XsObjectWithReflection()
public XsObjectSerializable(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 XsObjectSerializable(java.lang.String ser) throws XsObjectException
The passed String is supposed to be created by a 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.Method Detail |
public final java.lang.String serialize() throws XsObjectException
deserialize(String)
to recreate the object contents.
Only read/write properties are serialized.
The format is defined in BNF as:
key ::= property {property}
property ::= name = delimiter text delimiter separator | name = separator
name ::= simplechar {simplechar}
text ::= complexchar {complexchar}
escape ::= '\\'
delimiter ::= '|'
separator ::= ';'
simplechar ::= all_ascii_except_escape_delimiter_separator_eos
complexchar ::= simplechar | escape delimiter | escape escape | escape u hex hex hex hex
hex ::= hexadecimal_digit
Escape, delimiter, separator and EOS characters are defined as constants
into XsObjectUtil
.
XsObjectException
- thrown if an error occurs during serialization of the string.public final XsObjectSerializable deserialize(java.lang.String s) throws XsObjectException
serialize()
, sets
the object's properties. Returns itself.
s
- serialized rapresentation of an object of this class.
XsObjectException
- thrown if an error occurs during deserialization of the string.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |