com.crystaldecisions.sdk.occa.report.lib
Class PropertyBag

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by com.crystaldecisions.sdk.occa.report.lib.ClonableMap<K,V>
              extended by com.crystaldecisions.sdk.occa.report.lib.ControllableMap<java.lang.Object,java.lang.Object>
                  extended by com.crystaldecisions.sdk.occa.report.lib.PropertyBag
All Implemented Interfaces:
IClone, java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class PropertyBag
extends ControllableMap<java.lang.Object,java.lang.Object>
implements IClone

This class defines a property bag that stores a list of properties. The properties contained in the bag may be of different types: they may be any of the primitive types, or an object. Use the get and put methods to retrieve and store properties.

See Also:
Serialized Form

Constructor Summary
PropertyBag()
           Constructs an empty property bag with the default capacity and load factor.
PropertyBag(java.util.Map defaults)
           Constructs a new property bag with the same mappings as the given map.
PropertyBag(PropertyBag src)
           
 
Method Summary
 java.lang.Object clone(boolean deepClone)
           
 java.lang.Object createMember(java.lang.String eleName, org.xml.sax.Attributes attrs, XMLSerializationContext ctxt, java.util.Map objState, boolean[] bLoaded)
          For internal use only.
 void endElement(java.lang.String eleName, java.util.Map objState)
          For internal use only.
 boolean getBooleanValue(java.lang.Object key)
           Converts a value in the property bag and returns it as a boolean value. 0 is treated as false.
 double getDoubleValue(java.lang.Object key)
           Converts a value in the property bag and returns it as a double value.
 int getIntValue(java.lang.Object key)
           Converts a value in the property bag and returns it as an int value.
 IStrings getPropertyIDs()
           Returns a list of IDs for all the properties stored in the property bag.
 java.lang.String getStringValue(java.lang.Object key)
           Converts a value in the property bag and returns it as a string value.
 void putBooleanValue(java.lang.Object key, boolean value)
           Associates the supplied property ID with the specified boolean.
 void putDoubleValue(java.lang.Object key, double value)
           Associates the supplied property ID with the specified double.
 void putIntValue(java.lang.Object key, int value)
           Associates the supplied property ID with the specified int.
 void putStringValue(java.lang.Object key, java.lang.String value)
           Associates the supplied property ID with the specified String.
 void readElement(java.lang.String eleName, java.lang.String sVal, org.xml.sax.Attributes attrs, java.util.Map objState)
          For internal use only.
 void save(XMLWriter writer, java.lang.String sTag, XMLSerializationContext ctxt)
          For internal use only.
 void save(XMLWriter writer, XMLSerializationContext ctxt)
          For internal use only.
 void saveContents(XMLWriter writer, XMLSerializationContext ctxt)
          For internal use only.
 boolean skipWritingIdenticalObject()
          For internal use only.
 void startElement(java.lang.String eleName, java.util.Map objState, org.xml.sax.Attributes attrs)
          For internal use only.
 
Methods inherited from class com.crystaldecisions.sdk.occa.report.lib.ControllableMap
clear, doControllerModification, entrySet, enumerateMembers, getControllableMixin, isDirectlyControllable, keySet, put, putAll, remove, values
 
Methods inherited from class com.crystaldecisions.sdk.occa.report.lib.ClonableMap
copyTo, hasContent
 
Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, get, isEmpty, size
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

PropertyBag

public PropertyBag(PropertyBag src)

PropertyBag

public PropertyBag()

Constructs an empty property bag with the default capacity and load factor.


PropertyBag

public PropertyBag(java.util.Map defaults)

Constructs a new property bag with the same mappings as the given map.

Parameters:
defaults - The map whose mappings are to be placed in this property bag.
Method Detail

clone

public java.lang.Object clone(boolean deepClone)
Overrides:
clone in class ClonableMap<java.lang.Object,java.lang.Object>

createMember

public java.lang.Object createMember(java.lang.String eleName,
                                     org.xml.sax.Attributes attrs,
                                     XMLSerializationContext ctxt,
                                     java.util.Map objState,
                                     boolean[] bLoaded)

For internal use only.


endElement

public void endElement(java.lang.String eleName,
                       java.util.Map objState)

For internal use only.


getBooleanValue

public boolean getBooleanValue(java.lang.Object key)
                        throws java.lang.NullPointerException

Converts a value in the property bag and returns it as a boolean value. 0 is treated as false. All other numbers (positive and negative) are treated as true. The string "No" is converted to false, while the string "Yes" is converted to true. The strings "True" and "False" can also be used. A non-zero, numeric string will return true. If the value cannot be converted, the property fails.

Parameters:
key - The ID of the property to convert and return.
Returns:
A boolean corresponding to the value of the specified key.
Throws:
java.lang.NullPointerException - if the key doesn't exist

getDoubleValue

public double getDoubleValue(java.lang.Object key)
                      throws java.lang.NullPointerException

Converts a value in the property bag and returns it as a double value. If the value cannot be converted, the property fails.

Parameters:
key - The ID of the property to convert and return.
Returns:
A double corresponding to the value of the specified key.
Throws:
java.lang.NullPointerException - if the key doesn't exist

getIntValue

public int getIntValue(java.lang.Object key)
                throws java.lang.NullPointerException

Converts a value in the property bag and returns it as an int value.

Parameters:
key - The ID of the property to convert and return.
Returns:
An int corresponding to the value of the specified key.
Throws:
java.lang.NullPointerException - if the key doesn't exist

getPropertyIDs

public IStrings getPropertyIDs()

Returns a list of IDs for all the properties stored in the property bag. You can use this list together with the get method to enumerate through all the items in the property bag.

Returns:
An IStrings object containing a list of IDs for all the properties stored in the property bag.

getStringValue

public java.lang.String getStringValue(java.lang.Object key)

Converts a value in the property bag and returns it as a string value. If the value cannot be converted, the property fails.

Parameters:
key - The ID of the property to convert and return.
Returns:
A String corresponding to the value of the specified key.

putBooleanValue

public void putBooleanValue(java.lang.Object key,
                            boolean value)

Associates the supplied property ID with the specified boolean.

Parameters:
key - The ID of the property to assign the value to.
value - The boolean value of the specified property ID.

putDoubleValue

public void putDoubleValue(java.lang.Object key,
                           double value)

Associates the supplied property ID with the specified double.

Parameters:
key - The ID of the property to assign the value to.
value - The double value of the specified property ID.

putIntValue

public void putIntValue(java.lang.Object key,
                        int value)

Associates the supplied property ID with the specified int.

Parameters:
key - The ID of the property to assign the value to.
value - The int value of the specified property ID.

putStringValue

public void putStringValue(java.lang.Object key,
                           java.lang.String value)

Associates the supplied property ID with the specified String.

Parameters:
key - The ID of the property to assign the value to.
value - The String value of the specified property ID.

readElement

public void readElement(java.lang.String eleName,
                        java.lang.String sVal,
                        org.xml.sax.Attributes attrs,
                        java.util.Map objState)

For internal use only.


save

public void save(XMLWriter writer,
                 XMLSerializationContext ctxt)
          throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

save

public void save(XMLWriter writer,
                 java.lang.String sTag,
                 XMLSerializationContext ctxt)
          throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

saveContents

public void saveContents(XMLWriter writer,
                         XMLSerializationContext ctxt)
                  throws java.io.IOException

For internal use only.

Throws:
java.io.IOException

startElement

public void startElement(java.lang.String eleName,
                         java.util.Map objState,
                         org.xml.sax.Attributes attrs)

For internal use only.


skipWritingIdenticalObject

public boolean skipWritingIdenticalObject()

For internal use only.