Class ELPropertyContentProvider
java.lang.Object
com.webmethods.caf.faces.bean.PageFlowScopeAdapter
com.webmethods.caf.faces.data.object.ELPropertyContentProvider
- All Implemented Interfaces:
IPageFlowScopeAdapter
,IContentProvider
,IUpdateableContentProvider
,Serializable
- Direct Known Subclasses:
BoundChildrenNode.PermissiveContentProviderWrapper
,ScalarTableContentProvider
public class ELPropertyContentProvider
extends PageFlowScopeAdapter
implements Serializable, IUpdateableContentProvider
IUpdateableContentProvider
implementation that wraps any object and accesses its properties
using faces' expression language.
class Item { public int getId(); public String getName(); }; Item item = new Item("1", "First Item"); IUpdateableContentProvider provider = new ELPropertyContentProvider(item); Integer itemId = (Integer)provider.getValue("id"); // returns 1 String itemName = (String)provider.getValue("name"); // return "First Item" provider.setValue("name", "The new name"); // update the items name property
- See Also:
-
Field Summary
FieldsFields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Initializes with the given object -
Method Summary
Modifier and TypeMethodDescriptionReturns currently wrapped objectObject[]
Returns list of properties supported by this content provider.Class<?>
Returns java type of the given propertyReturns value of the given propertyboolean
hasProperty
(Object propertyKey) Checks if the given property is supported by this content providerboolean
isReadOnly
(Object propertyKey) Returns true if the given property is readonly.void
Sets an object to wrap.void
Sets new value of the given propertytoString()
Returns string representation of content.Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
-
Field Details
-
m_o
Wrapped object
-
-
Constructor Details
-
ELPropertyContentProvider
public ELPropertyContentProvider()Default constructor.setObject(Object)
must be called before use. -
ELPropertyContentProvider
Initializes with the given object- Parameters:
o
- any object to adapt
-
-
Method Details
-
toString
Description copied from interface:IContentProvider
Returns string representation of content.- Specified by:
toString
in interfaceIContentProvider
- Overrides:
toString
in classObject
- Returns:
String
representation of the wrapped content
-
getPropertyKeys
Description copied from interface:IContentProvider
Returns list of properties supported by this content provider. Can returnObject[0]
, never null.- Specified by:
getPropertyKeys
in interfaceIContentProvider
- Returns:
- array of property keys which is typically of type
String
orInteger
-
getType
Description copied from interface:IContentProvider
Returns java type of the given property- Specified by:
getType
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- property java
Class
- Throws:
PropertyNotFoundException
- if property is not supported
-
getValue
Description copied from interface:IContentProvider
Returns value of the given property- Specified by:
getValue
in interfaceIContentProvider
- Parameters:
propertyKey
- the property key of typeString
orInteger
- Returns:
- value of the property, can be
null
- Throws:
PropertyNotFoundException
- if property is not supportedELException
-
hasProperty
Description copied from interface:IContentProvider
Checks if the given property is supported by this content provider- Specified by:
hasProperty
in interfaceIContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
true
if property is supported
-
isReadOnly
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 interfaceIUpdateableContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
- Returns:
- true if the property is readonly
- Throws:
PropertyNotFoundException
ELException
-
setValue
public void setValue(Object propertyKey, Object value) throws ELException, PropertyNotFoundException Description copied from interface:IUpdateableContentProvider
Sets new value of the given property
- Specified by:
setValue
in interfaceIUpdateableContentProvider
- Parameters:
propertyKey
- property key of typeString
orInteger
value
- new property value- Throws:
PropertyNotFoundException
- if property is not foundELException
-
setObject
Sets an object to wrap. Should be called once at initialization time before any other methods are used. -
getObject
Returns currently wrapped object- Returns:
- null if not set
-