com.primix.tapestry.util.prop
Class MapHelper

java.lang.Object
  |
  +--com.primix.tapestry.util.prop.PropertyHelper
        |
        +--com.primix.tapestry.util.prop.MapHelper

public class MapHelper
extends PropertyHelper

A subclass of PropertyHelper that allows values of a java.util.Map to be accessed as if they were JavaBean properties of the java.util.Map itself.

This requires that the keys of the Map be valid JavaBeans property names.

This class includes a static initializer that invokes PropertyHelper.register(Class,Class).

TBD: Better error detection.

Version:
$Id: MapHelper.java,v 1.8 2001/10/08 18:28:40 hship Exp $
Author:
Howard Ship

Inner Class Summary
static class MapHelper.MapAccessor
           
 
Fields inherited from class com.primix.tapestry.util.prop.PropertyHelper
accessors, beanClass, PATH_SEPERATOR
 
Constructor Summary
MapHelper(java.lang.Class beanClass)
           
 
Method Summary
 IPropertyAccessor getAccessor(java.lang.Object instance, java.lang.String name)
          Finds an accessor for the given property name.
 java.util.Collection getSyntheticPropertyNames(java.lang.Object instance)
          Returns a Collection of the names of any synthetic properties.
 
Methods inherited from class com.primix.tapestry.util.prop.PropertyHelper
buildPropertyAccessors, forClass, forInstance, get, getAccessorPath, getAccessors, getPath, getPath, isReadable, isWritable, register, set, setPath, setPath, splitPropertyPath, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapHelper

public MapHelper(java.lang.Class beanClass)
Method Detail

getAccessor

public IPropertyAccessor getAccessor(java.lang.Object instance,
                                     java.lang.String name)
Description copied from class: PropertyHelper
Finds an accessor for the given property name. Returns the accessor if the class has the named property, or null otherwise.
Overrides:
getAccessor in class PropertyHelper
Following copied from class: com.primix.tapestry.util.prop.PropertyHelper
Parameters:
propertyName - the simple property name of the property to get.

getSyntheticPropertyNames

public java.util.Collection getSyntheticPropertyNames(java.lang.Object instance)
Description copied from class: PropertyHelper
Returns a Collection of the names of any synthetic properties.

Subclasses should override this to interrogate the instance in an appropriate way, so as to extract this list of properties. For example, MapHelper casts the instance to Map, and returns the map's keySet.

Subclasses may override this implementation without invoking it. This implementation returns null.

Overrides:
getSyntheticPropertyNames in class PropertyHelper
Since:
1.0.6