Lizzy v1.1.1

christophedelory.plist
Class Dict

java.lang.Object
  extended by christophedelory.plist.PlistObject
      extended by christophedelory.plist.Dict

public class Dict
extends PlistObject

A plist dictionary collection.

Version:
$Revision: 92 $
Author:
Christophe Delory

Constructor Summary
Dict()
           
 
Method Summary
 void addKeyOrObject(PlistObject object)
          Deprecated. for Castor's usage. Use put(christophedelory.plist.Key, christophedelory.plist.PlistObject) instead.
 PlistObject findObjectByKey(String keyString)
          Searches for the object associated with the specified key in this dictionary.
 Hashtable<Key,PlistObject> getDictionary()
          Returns the dictionary of plist keys and their associated objects.
 List<PlistObject> getKeysAndObjects()
          Deprecated. for Castor's usage. Use getDictionary() instead.
 PlistObject put(Key key, PlistObject object)
          Maps a key to the specified plist object.
 PlistObject put(String key, PlistObject object)
          Maps a key string to the specified plist object.
 
Methods inherited from class christophedelory.plist.PlistObject
getParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dict

public Dict()
Method Detail

getDictionary

public Hashtable<Key,PlistObject> getDictionary()
Returns the dictionary of plist keys and their associated objects.

Returns:
a map of keys to plist objects. May be empty but not null.
See Also:
put(christophedelory.plist.Key, christophedelory.plist.PlistObject)

put

public PlistObject put(Key key,
                       PlistObject object)
Maps a key to the specified plist object.

Parameters:
key - a key. Shall not be null.
object - a plist object. Shall not be null.
Returns:
the previous value of the specified key in this dictionary, or null if it did not have one.
Throws:
NullPointerException - if key is null.
NullPointerException - if object is null.
See Also:
getDictionary()

put

public PlistObject put(String key,
                       PlistObject object)
Maps a key string to the specified plist object. This is a convenience method, equivalent to "put(new Key(key), object)".

Parameters:
key - a key string. Shall not be null.
object - a plist object. Shall not be null.
Returns:
the previous value of the specified key in this dictionary, or null if it did not have one.
Throws:
NullPointerException - if key is null.
NullPointerException - if object is null.
See Also:
put(Key,PlistObject)

getKeysAndObjects

@Deprecated
public List<PlistObject> getKeysAndObjects()
Deprecated. for Castor's usage. Use getDictionary() instead.

Returns all plist objects (including keys) in this dictionary as a list. This method allows the Castor framework to marshal the dictionary to XML. The developer should rather use the getDictionary() method. That's why it is tagged as deprecated.

Returns:
a list of plist objects. May be empty but not null.
See Also:
addKeyOrObject(christophedelory.plist.PlistObject), getDictionary()

addKeyOrObject

@Deprecated
public void addKeyOrObject(PlistObject object)
Deprecated. for Castor's usage. Use put(christophedelory.plist.Key, christophedelory.plist.PlistObject) instead.

Adds the specified plist object. This method allows the Castor framework to unmarshal the dictionary from XML. The developer should rather use the put(christophedelory.plist.Key, christophedelory.plist.PlistObject) method. That's why it is tagged as deprecated.

Parameters:
object - a plist object. Shall not be null.
Throws:
NullPointerException - if object is null.
IllegalArgumentException - if this object is unexpected at this position.
See Also:
getKeysAndObjects(), put(christophedelory.plist.Key, christophedelory.plist.PlistObject)

findObjectByKey

public PlistObject findObjectByKey(String keyString)
Searches for the object associated with the specified key in this dictionary.

Parameters:
keyString - the key string to search for. Shall not be null.
Returns:
a plist object, or null if none was found.
Throws:
NullPointerException - if keyString is null.

© 2008-2009 Christophe Delory

Copyright © 2008-2009 Christophe Delory. All Rights Reserved.