|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eocontrol.EOKeyValueArchiver
EOKeyValueArchiver objects are used to archive a graph of objects into a "property list" with a key-value mechanism. To (re)create the object graph, EOKeyValueUnarchiver objects are used. A typical way to use EOKeyValueArchiver/EOKeyValueUnarchiver is:
Object objectToArchive = ...; EOKeyValueArchiver archiver = new EOKeyValueArchiver(); archiver.setDelegate(...); archiver.encodeObject(objectToArchive, "ArchiveName"); NSDictionary archive = archiver.dictionary();
Afterwards, to recreate the object graph:
NSDictionary archive = ...; // for example a dictionary loaded from a file EOKeyValueUnarchiver unarchiver = new EOKeyValueUnarchiver(archive); unarchiver.setDelegate(...); Object archivedObject = unarchiver.decodeObjectForKey("ArchiveName"); unarchiver.finishInitializationOfObjects(); unarchiver.awakeObjects();
EOKeyValueUnarchiver
,
EOKeyValueArchiving
Nested Class Summary | |
static interface |
EOKeyValueArchiver.Delegate
The EOKeyValueArchiver.Delegate interface defines methods which can be used by a delegate object of an EOKeyValueArchiver to control the behavior of the archiver object. |
Constructor Summary | |
EOKeyValueArchiver()
Creates a new EOKeyValueArchiver. |
Method Summary | |
Object |
delegate()
Returns the receiver's delegate. |
NSDictionary |
dictionary()
Returns the property list which represents the object archive. |
void |
encodeBool(boolean value,
String key)
Archives the boolean value under the key key . |
void |
encodeInt(int value,
String key)
Archives the integer value under the key key . |
void |
encodeObject(Object object,
String key)
Archives the object object in place under the key key . |
void |
encodeReferenceToObject(Object object,
String key)
Archives the object object with a special reference (placeholder)
under the key key . |
void |
setDelegate(Object delegate)
Sets the receiver's delegate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EOKeyValueArchiver()
Method Detail |
public Object delegate()
public NSDictionary dictionary()
public void encodeBool(boolean value, String key)
value
under the key key
.
value
- the boolean to be archivedkey
- the key under which it is storedEOKeyValueArchiving
public void encodeInt(int value, String key)
value
under the key key
.
value
- the integer to be archivedkey
- the key under which it is storedEOKeyValueArchiving
public void encodeObject(Object object, String key)
object
in place under the key key
.
The object either needs to be an instance of the NSArray or NSDictionary class,
implement the EOKeyValueArchiving interface, or have a Support object registered
with EOKeyValueArchiving. For objects that implement EOKeyValueArchiving, this
method calls object
with encodeWithKeyValueArchiver
.
object
- the object to be archivedkey
- the key under which it is storedEOKeyValueArchiving
,
EOKeyValueArchiving.Support
public void encodeReferenceToObject(Object object, String key)
object
with a special reference (placeholder)
under the key key
. The reference object is determined by asking
the receiver's delegate with the referenceToEncodeForObject
method.
object
- the object to be archived as a referencekey
- the key under which it is storedEOKeyValueArchiver.Delegate
,
EOKeyValueArchiving
public void setDelegate(Object delegate)
delegate
- the delegate
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |