com.togethersoft.openapi.util.propertyMap
Class DefaultPropertyMap


public class DefaultPropertyMap
implements PropertyMap

DefaultPropertyMap class is a generic-use implementation of a PropertyMap interface.
It provides the minimal functionality of all PropertyMap's methods, but still enough for using it
in many cases. To get a more sophisticated PropertyMap instance, one have to define its own class
implementing PropertyMap interface.

Author:
TogetherSoft
Since: Together 4.0

Inner Class Summary
 public classDefaultPropertyMap.DefaultProperty
           

Field Summary
 private EventMulticastermyAllKeysMulticaster
           
 private VectormyKeys
           
 private HashtablemyMap
           
 private HashtablemyMulticasterMap
           

Method Summary
 PropertyaddProperty(Object propertyKey, Object propertyValue)
          Adds new property.
 voidaddPropertyMapListener(Object propertyKey, PropertyMapListener listener)
          Adds listener of PropertyMapEvent for certain property.
 protected voidaddPropertyToEnd(DefaultProperty property)
          Adds specified property to the end of property list.
 booleancanAddProperty(Object propertyKey, Object propertyValue)
          Checks whether it is possible to add specified property with specified value.
 booleancanSetPropertyValue(Object propertyKey, Object propertyValue)
          Checks whether it is possible to set specified value for specified property.
 protected DefaultPropertycreateProperty(Object key, Object value)
          Creates and returns a property with the specified key and value.
 protected voidfireEvent(PropertyMapEvent event)
          Fires specified PropertyMapEvent.
 ObjectgetPropertyValue(Object propertyKey)
          Return value of property with specified key.
 ObjectgetPropertyValue(Object propertyKey, Class valueClass)
          Return value of property with specified key and class of value.
 booleanisPropertyReadable(Object propertyKey)
          Checks whether it is possible to read value(s) of specified property.
 booleanisPropertyWritable(Object propertyKey)
          Checks whether it is possible to write value(s) to specified property.
 Enumerationproperties()
          Returns Enumeration of properties.
 Enumerationproperties(Object propertyKey)
          Returns Enumeration of all values of given property.
 voidremovePropertyMapListener(Object propertyKey, PropertyMapListener listener)
          Removes listener of PropertyMapEvent for certain property.
 voidsetPropertyValue(Object propertyKey, Object propertyValue)
          Sets specified value for specified property.
 StringtoString()
          Returns a string containing the pairs key-value for all properties in this PropertyMap.

Field Detail

myAllKeysMulticaster

private EventMulticaster myAllKeysMulticaster

myKeys

private Vector myKeys

myMap

private Hashtable myMap

myMulticasterMap

private Hashtable myMulticasterMap
Method Detail

addProperty

public Property addProperty(Object propertyKey, Object propertyValue)
Adds new property.
Parameters:
propertyKey Name of new property
propertyValue Value of new property
Returns: Added property

addPropertyMapListener

public void addPropertyMapListener(Object propertyKey, PropertyMapListener listener)
Adds listener of PropertyMapEvent for certain property.
Parameters:
propertyKey Key of property for which listener will be added
l Listener to be added

addPropertyToEnd

protected void addPropertyToEnd(DefaultProperty property)
Adds specified property to the end of property list.
Parameters:
property Property to be added

canAddProperty

public boolean canAddProperty(Object propertyKey, Object propertyValue)
Checks whether it is possible to add specified property with specified value.
Parameters:
propertyKey Name of property to be checked
propertyValue Value to be checked
Returns: true if it is possible, false otherwise

canSetPropertyValue

public boolean canSetPropertyValue(Object propertyKey, Object propertyValue)
Checks whether it is possible to set specified value for specified property.
Parameters:
propertyKey Name of property to be checked
propertyValue Value to be checked
Returns: true if it is possible, false otherwise

createProperty

protected DefaultProperty createProperty(Object key, Object value)
Creates and returns a property with the specified key and value.
Parameters:
key a key object
value a value which needs to be set for this property
Returns: new just created property
See Also:
Property

fireEvent

protected void fireEvent(PropertyMapEvent event)
Fires specified PropertyMapEvent.
Parameters:
event PropertyMapEvent to be fired

getPropertyValue

public Object getPropertyValue(Object propertyKey)
Return value of property with specified key.
Parameters:
propertyKey Property name for which value will be returned

getPropertyValue

public Object getPropertyValue(Object propertyKey, Class valueClass)
throws CastNotSupportedException
Return value of property with specified key and class of value.
Parameters:
propertyKey Property name for which value will be returned
valueClass Class of value
Returns: Value if property not null, otherwise returns null

isPropertyReadable

public boolean isPropertyReadable(Object propertyKey)
Checks whether it is possible to read value(s) of specified property.
Parameters:
propertKey Key of property to be checked
Returns: true if it is possible, false otherwise

isPropertyWritable

public boolean isPropertyWritable(Object propertyKey)
Checks whether it is possible to write value(s) to specified property.
Parameters:
propertKey Key of property to be checked
Returns: true if it is possible, false otherwise

properties

public Enumeration properties()
Returns Enumeration of properties.
Returns: Enumeration of properties

properties

public Enumeration properties(Object propertyKey)
Returns Enumeration of all values of given property.
Parameters:
propertyKey Key of property
Returns: Enumeration of all values of given property

removePropertyMapListener

public void removePropertyMapListener(Object propertyKey, PropertyMapListener listener)
Removes listener of PropertyMapEvent for certain property.
Parameters:
propertyKey Key of property for which listener will be removed
l Listener to be added

setPropertyValue

public void setPropertyValue(Object propertyKey, Object propertyValue)
Sets specified value for specified property.
Parameters:
propertyKey Name of property to which new value will be set
propertyValue Value which will be set

toString

public String toString()
Returns a string containing the pairs key-value for all properties in this PropertyMap.
Returns: a string containing the pairs key-value for all properties in this PropertyMap

Association Links

to Class java.util.Hashtable

to Class java.util.Vector

to Class java.util.Hashtable

to Class com.togethersoft.openapi.util.EventMulticaster