com.sas.collection
Interface StaticPropertyBagInterface

All Superinterfaces:
java.lang.Cloneable, com.sas.util.Countable, PropertyBagChangedSource, com.sas.PublicClonable
All Known Subinterfaces:
PropertyBagInterface, RangeSegmentInterface
All Known Implementing Classes:
BorderStyle, CellStyle, CellVectorStyle, ColumnStyle, DynamicPropertyBag, FontStyle, NodeStyle, ParameterBag, PropertyBag, RangeSegment, RowStyle, TextElement

public interface StaticPropertyBagInterface
extends com.sas.PublicClonable, PropertyBagChangedSource, com.sas.util.Countable

A StaticPropertyBagInterface defines a read-only set of properties, much like a Dictionary but simpler: keys must be Strings. Abstractly, a property bag is like a Java Bean with a set of dynamic as opposed to fixed properties. The set of properties on an instance can change over time.

A property bag emits a PropertyBagChangedEvent events when the bag has changed (i.e. items added or removed from the bag). A property bag also fires change events when an item in the bag changes its state (provided that item is a com.sas.collection.PropertyChangedSource or com.sas.beans.PropertyChangeSource).

This interface defines the read-only methods to access the contents of a property bag, or to add a listener for change events. Use PropertybadInterface for the update methods.

See Also:
PropertyBag, PropertyBagInterface, PropertyBagChangedSource, PropertyChangeSource, PropertyBagChangedEvent, DictionaryInterface

Method Summary
abstract  java.lang.Object clone()
          Clone a property bag.
abstract  boolean containsKey(java.lang.String key)
          Determine if this property bag contains a property with this name (key).
abstract  int count()
          Return the number of properties in this property bag.
abstract  java.lang.Object get(java.lang.String key)
          Get an item from a property bag.
abstract  java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
          Get an item from a property bag, or return a default if it does not exist.
abstract  java.lang.String[] listKeys()
          Return a list of the keys for this property bag.
abstract  DictionaryInterface toDictionary(DictionaryInterface initialDictionary)
          Place this property bag's items into a dictionary and return that dictionary.
 
Methods inherited from interface com.sas.collection.PropertyBagChangedSource
addPropertyBagChangedListener, removePropertyBagChangedListener
 

Method Detail

count

int count()
Return the number of properties in this property bag.

Specified by:
count in interface com.sas.util.Countable
Returns:
the number of properties in this property bag.

containsKey

boolean containsKey(java.lang.String key)
Determine if this property bag contains a property with this name (key).

Parameters:
key - the name of the property. This string must be an interned string and may not be null. (Use key.intern() to create an interned string.)
Returns:
true if this property bag contains the property.

get

java.lang.Object get(java.lang.String key)
Get an item from a property bag.

Parameters:
key - the name of the property. This string must be an interned string and may not be null. (Use key.intern() to create an interned string.)
Returns:
the object associated with the key
Throws:
java.util.NoSuchElementException - if there is no such property in this property bag. (this is necessary to distinguish between no such key and a property value of null.)

get

java.lang.Object get(java.lang.String key,
                     java.lang.Object defaultValue)
Get an item from a property bag, or return a default if it does not exist.

Parameters:
key - the name of the property. This string must be an interned string and may not be null. (Use key.intern() to create an interned string.)
defaultValue - a default value to return if the named property does not exist in this property bag. See also PropertyBag.NO_SUCH_ELEMENT for a value you can use if you want to combine a test for existence with a get operation.
Returns:
the object associated with the key, or the defaultValue if the bag does not contain an element for the specified key.

toDictionary

DictionaryInterface toDictionary(DictionaryInterface initialDictionary)
Place this property bag's items into a dictionary and return that dictionary.

Parameters:
initialDictionary - a dictionary into which this property bag places all of its values via set(key, value). The dictionary may be null, in which case a new Dictionary is created.
Returns:
the dictionary containing this property bag's contents.

listKeys

java.lang.String[] listKeys()
Return a list of the keys for this property bag. An array is used instead of an Enumeration, for efficiency. However, note that this means the array may become stale.

Returns:
an array containing the property keys
See Also:
StringCollection

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone a property bag.

Specified by:
clone in interface com.sas.PublicClonable
Throws:
java.lang.CloneNotSupportedException - if the object cannot be cloned.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.