| 
 | WebObjects 5.4.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.webobjects.eocontrol.EOKeyValueArchiver
public class 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.DelegateThe 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 valueunder the keykey. | 
|  void | encodeInt(int value,
          String key)Archives the integer valueunder the keykey. | 
|  void | encodeObject(Object object,
             String key)Archives the object objectin place under the keykey. | 
|  void | encodeReferenceToObject(Object object,
                        String key)Archives the object objectwith a special reference (placeholder) under the keykey. | 
|  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 void setDelegate(Object delegate)
delegate - the delegatepublic Object delegate()
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 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 storedEOKeyValueArchivingpublic NSDictionary dictionary()
| 
 | Last updated June 2008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||