com.togethersoft.openapi.util.propertyMap
Interface PropertyMap

All Known Subinterfaces:
VirtualFile, VirtualFileContext, VirtualFileManagerContext, VirtualFileVolumeContext
All Known Implementing Classes:
DefaultPropertyMap, SwitchablePropertyMap

public interface PropertyMap

Provides a flexibile mechanism for working with object's properties.
A property for this interface is a key-value pair with both key and value of Object type.
It is possible to have one-to-many relationships between a key and a value.
To assign a listener to any property, use the addPropertyMapListener method.

Author:
TogetherSoft
Since: Together 4.0

Method Summary
 PropertyaddProperty(Object propertyKey, Object propertyValue)
          Adds a property with the specified value to the properties set.
 voidaddPropertyMapListener(Object propertyKey, PropertyMapListener listener)
          Adds a listener to the specified property.
 booleancanAddProperty(Object propertyKey, Object propertyValue)
          Checks whether a property with the specified value can be added to the properties set.
 booleancanSetPropertyValue(Object propertyKey, Object propertyValue)
          Checks whether the specified value can be set for the property.
 ObjectgetPropertyValue(Object propertyKey)
          Returns a value of the property.
 ObjectgetPropertyValue(Object propertyKey, Class valueClass)
          Returns a value of the property as a specified class instance.
 booleanisPropertyReadable(Object propertyKey)
          Checks whether the property is readable.
 booleanisPropertyWritable(Object propertyKey)
          Checks whether the property is writable.
 Enumerationproperties()
          Returns an enumeration of all properties containded in this PropertyMap.
 Enumerationproperties(Object propertyKey)
          Returns an enumeration of all properties with the same key value containded in this PropertyMap.
 voidremovePropertyMapListener(Object propertyKey, PropertyMapListener listener)
          Removes a listener of the specified property.
 voidsetPropertyValue(Object propertyKey, Object propertyValue)
          Sets a value for the specified property.

Method Detail

addProperty

public Property addProperty(Object propertyKey, Object propertyValue)
Adds a property with the specified value to the properties set.
Parameters:
propertyKey a key object
propertyValue a value which needs to be set
Returns: a new just created property.
See Also:
Property

addPropertyMapListener

public void addPropertyMapListener(Object propertyKey, PropertyMapListener listener)
Adds a listener to the specified property.
Parameters:
propertyKey a key object
listener a PropertyMapListener object
See Also:
PropertyMapListener

canAddProperty

public boolean canAddProperty(Object propertyKey, Object propertyValue)
Checks whether a property with the specified value can be added to the properties set.
Parameters:
propertyKey a key object
propertyValue a value which needs to be set
Returns: true if a property with the specified value can be added to the properties set,
false otherwise

canSetPropertyValue

public boolean canSetPropertyValue(Object propertyKey, Object propertyValue)
Checks whether the specified value can be set for the property.
Parameters:
propertyKey a key object
propertyValue a value which needs to be set
Returns: true if the specified value can be set as a value for the property,
false otherwise

getPropertyValue

public Object getPropertyValue(Object propertyKey)
Returns a value of the property.
Parameters:
propertyKey a key object
Returns: a value of the property

getPropertyValue

public Object getPropertyValue(Object propertyKey, Class valueClass)
throws CastNotSupportedException
Returns a value of the property as a specified class instance.
Parameters:
propertyKey a key object
valueClass a class (superclass) of a value of the property
Returns: a value of the property
Throws:
CastNotSupportedException If class of a value of this property is not a subclass or the same
class that the specified class

isPropertyReadable

public boolean isPropertyReadable(Object propertyKey)
Checks whether the property is readable.
Parameters:
propertyKey a key object
Returns: true if the property is readable, false otherwise

isPropertyWritable

public boolean isPropertyWritable(Object propertyKey)
Checks whether the property is writable.
Parameters:
propertyKey a key object
Returns: true if the property is writable, false otherwise

properties

public Enumeration properties()
Returns an enumeration of all properties containded in this PropertyMap.
Returns: an enumeration of all properties containded in this PropertyMap

properties

public Enumeration properties(Object propertyKey)
Returns an enumeration of all properties with the same key value containded in this PropertyMap.
Returns: an enumeration of all properties with the same key value containded in this PropertyMap

removePropertyMapListener

public void removePropertyMapListener(Object propertyKey, PropertyMapListener listener)
Removes a listener of the specified property.
Parameters:
propertyKey a key object
listener a PropertyMapListener object
See Also:
PropertyMapListener

setPropertyValue

public void setPropertyValue(Object propertyKey, Object propertyValue)
Sets a value for the specified property.
Parameters:
propertyKey a key object
propertyValue a value which needs to be set