com.webmethods.caf.faces.data.object
Class MapContentProvider

java.lang.Object
  extended by com.webmethods.caf.faces.data.object.MapContentProvider
All Implemented Interfaces:
IContentProvider, IUpdateableContentProvider

public class MapContentProvider
extends Object
implements IContentProvider, IUpdateableContentProvider

Adapts a Map to an IContentProvider.


Field Summary
protected  Map m_map
           
 
Constructor Summary
MapContentProvider(Map m)
           
 
Method Summary
 Object[] getPropertyKeys()
          Returns list of properties supported by this content provider.
 Class getType(Object propertyKey)
          Returns java type of the given property
 Object getValue(Object propertyKey)
          Returns value of the given property
 boolean hasProperty(Object propertyKey)
          Checks if the given property is supported by this content provider
 boolean isReadOnly(Object propertyKey)
          Returns true if the given property is readonly.
 void setValue(Object propertyKey, Object value)
          Sets new value of the given property
 String toString()
          Returns string representation of content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_map

protected Map m_map
Constructor Detail

MapContentProvider

public MapContentProvider(Map m)
Method Detail

toString

public String toString()
Description copied from interface: IContentProvider
Returns string representation of content.

Specified by:
toString in interface IContentProvider
Overrides:
toString in class Object
Returns:
String representation of the wrapped content

getPropertyKeys

public Object[] getPropertyKeys()
Description copied from interface: IContentProvider
Returns list of properties supported by this content provider. Can return Object[0], never null.

Specified by:
getPropertyKeys in interface IContentProvider
Returns:
array of property keys which is typically of type String or Integer

getType

public Class getType(Object propertyKey)
              throws PropertyNotFoundException
Description copied from interface: IContentProvider
Returns java type of the given property

Specified by:
getType in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
property java Class
Throws:
PropertyNotFoundException - if property is not supported

getValue

public Object getValue(Object propertyKey)
                throws EvaluationException,
                       PropertyNotFoundException
Description copied from interface: IContentProvider
Returns value of the given property

Specified by:
getValue in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
value of the property, can be null
Throws:
EvaluationException - if error during property evaluation
PropertyNotFoundException - if property is not supported

hasProperty

public boolean hasProperty(Object propertyKey)
Description copied from interface: IContentProvider
Checks if the given property is supported by this content provider

Specified by:
hasProperty in interface IContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if property is supported

isReadOnly

public boolean isReadOnly(Object propertyKey)
                   throws EvaluationException,
                          PropertyNotFoundException
Description copied from interface: IUpdateableContentProvider

Returns true if the given property is readonly. If it is readonly, IUpdateableContentProvider.setValue(Object, Object) will definitely fail.

Specified by:
isReadOnly in interface IUpdateableContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if the property is readonly
Throws:
EvaluationException
PropertyNotFoundException

setValue

public void setValue(Object propertyKey,
                     Object value)
              throws EvaluationException,
                     PropertyNotFoundException
Description copied from interface: IUpdateableContentProvider

Sets new value of the given property

Specified by:
setValue in interface IUpdateableContentProvider
Parameters:
propertyKey - property key of type String or Integer
value - new property value
Throws:
EvaluationException - if error happens during property assigment
PropertyNotFoundException - if property is not found