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

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended bycom.crystaldecisions.sdk.occa.report.lib.PropertyBag
All Implemented Interfaces:
java.lang.Cloneable, IClone, java.util.Map, java.io.Serializable

public class PropertyBag
extends java.util.HashMap
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)
           Constructs a new property bag with the same properties as the specified PropertyBag object.
 
Method Summary
 java.lang.Object clone(boolean deepClone)
          Returns the new object that has been cloned.
 void copyTo(java.lang.Object destObj, boolean deepCopy)
          Copies the object.
 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.
 boolean hasContent(java.lang.Object obj)
          Returns true if this object contains the same elements as the passed in object.
 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 java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
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)

Constructs a new property bag with the same properties as the specified PropertyBag object. This is equivalent to creating a new copy.

Parameters:
src - The PropertyBag object to be copied.

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)
Description copied from interface: IClone

Returns the new object that has been cloned.

Specified by:
clone in interface IClone
Parameters:
deepClone - true to use deep clone, false to use shallow.
Returns:
The new object that has been cloned.

copyTo

public void copyTo(java.lang.Object destObj,
                   boolean deepCopy)
Description copied from interface: IClone

Copies the object.

Specified by:
copyTo in interface IClone
Parameters:
destObj - The destination object to copy to.
deepCopy - true to use deep copy, false to use shallow.

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)

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.

getDoubleValue

public double getDoubleValue(java.lang.Object key)

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.

getIntValue

public int getIntValue(java.lang.Object key)

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.

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.

hasContent

public boolean hasContent(java.lang.Object obj)
Description copied from interface: IClone

Returns true if this object contains the same elements as the passed in object.

Specified by:
hasContent in interface IClone
Parameters:
obj - The object to check for content.
Returns:
true if this object contains the same elements as the passed in object, otherwise false.

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.