com.unitesk.atp.dynattrs
Class BeanMapAttributed

java.lang.Object
  extended by com.unitesk.atp.dynattrs.IndexedAttributedImpl
      extended by com.unitesk.atp.dynattrs.MapAttributed
          extended by com.unitesk.atp.dynattrs.BeanMapAttributed
All Implemented Interfaces:
Attributed, Serializable
Direct Known Subclasses:
TreeClass.NodeClass

public class BeanMapAttributed
extends MapAttributed

The implementation of Attributed interface that accesses attributes through getter and setter methods according to JavaBeans naming conventions and stores additional attributes in Map.

Version:
$Id: BeanMapAttributed.java,v 1.1 2004/10/09 06:19:04 all-x Exp $
Author:
Alexey Demakov
See Also:
Serialized Form

Constructor Summary
BeanMapAttributed()
          Class constructor with HashMap as the default map.
BeanMapAttributed(Map map)
          Class constructor with the specified map.
 
Method Summary
 Object getAttribute(String name)
          Retrieves the value of a simple attribute with the specified name.
 Set getAttributeNames()
          Returns the names of all attributes.
 boolean hasAttribute(String name)
          Checks existence of an attribute with the specified name.
 boolean isRemovable(String name)
          All existent attributes may be removed dynamically.
 boolean isWritable(String name)
          Always returns true - all attributes of this class are writable.
 void removeAttribute(String name)
          Removes an attribute with the specified name. If there is no attribute with the specified name nothing happens.
 void setAttribute(String name, Object value)
          Changes the value of a simple attribute with the specified name.
 
Methods inherited from class com.unitesk.atp.dynattrs.MapAttributed
addAttribute, createMap, isAttrCreatable
 
Methods inherited from class com.unitesk.atp.dynattrs.IndexedAttributedImpl
getAttribute, isIndexed, setAttribute, sizeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanMapAttributed

public BeanMapAttributed()
Class constructor with HashMap as the default map.


BeanMapAttributed

public BeanMapAttributed(Map map)
Class constructor with the specified map.

Parameters:
map - The map to store attributes.
Method Detail

hasAttribute

public boolean hasAttribute(String name)
Checks existence of an attribute with the specified name.

Specified by:
hasAttribute in interface Attributed
Overrides:
hasAttribute in class MapAttributed
Parameters:
name - The name of an attribute.
Returns:
true if there exists an attribute with the specified name, false otherwise.

isRemovable

public boolean isRemovable(String name)
All existent attributes may be removed dynamically.

Specified by:
isRemovable in interface Attributed
Overrides:
isRemovable in class MapAttributed
Parameters:
name - The name of an attribute.
Returns:
true if an attribute with the specified name may be removed dynamically, false otherwise.
See Also:
Attributed.hasAttribute(String)

isWritable

public boolean isWritable(String name)
Always returns true - all attributes of this class are writable.

Specified by:
isWritable in interface Attributed
Overrides:
isWritable in class MapAttributed
Parameters:
name - The name of an attribute.
Returns:
true if a value of an attribute with the specified name may be changed, false otherwise.
See Also:
Attributed.hasAttribute(String)

removeAttribute

public void removeAttribute(String name)
Removes an attribute with the specified name. If there is no attribute with the specified name nothing happens.

Specified by:
removeAttribute in interface Attributed
Overrides:
removeAttribute in class MapAttributed
Parameters:
name - The name of an attribute.
See Also:
Attributed.hasAttribute(String), Attributed.isRemovable(String)

getAttribute

public Object getAttribute(String name)
Retrieves the value of a simple attribute with the specified name.

Specified by:
getAttribute in interface Attributed
Overrides:
getAttribute in class MapAttributed
Parameters:
name - The name of an attribute.
Returns:
The value of an attribute.
See Also:
Attributed.hasAttribute(String)

setAttribute

public void setAttribute(String name,
                         Object value)
Changes the value of a simple attribute with the specified name.

Specified by:
setAttribute in interface Attributed
Overrides:
setAttribute in class MapAttributed
Parameters:
name - The name of an attribute.
value - The new value of an attribute.
See Also:
Attributed.hasAttribute(String), Attributed.isWritable(String)

getAttributeNames

public Set getAttributeNames()
Returns the names of all attributes.

Specified by:
getAttributeNames in interface Attributed
Overrides:
getAttributeNames in class MapAttributed
Returns:
The set containing the names of all attributes.
See Also:
Map.keySet()


Copyright © 2001-2006 ISP RAS, RedVerst Group. All Rights Reserved.