public class PropertyResolverImpl
extends javax.faces.el.PropertyResolver
Custom PropertyResolver
implementation that adds support
for DynaBean
property access to the facilities of the default
PropertyResolver
provided by JavaServer Faces.
This class implements the following specific rules:
PropertyResolver
instance that we are wrapping.DynaActionForm
, and the requested property name is
map
, maintain compatibility with the way that JSP and
JSTL expressions can access this property:
getValue()
will return the result of calling
getMap()
on the base object.setValue()
will throw an exception, because the
map of property values is a read-only property of the
DynaActionForm
class.isReadOnly()
returns true
.getType()
returns the Class
object
for java.util.Map
.DynaBean
, provide access to its named properties
as follows:
getValue()
will return the result of calling
get()
on the base object.setValue()
will call set()
on the base object.isReadOnly()
returns false
(because
the DynaBean APIs provide no mechanism to make this determination,
but most implementations will provide mutable properties).getType()
returns the Class
object
for the underlying dynamic property.PropertyResolver
that we
are wrapping.Constructor and Description |
---|
PropertyResolverImpl(javax.faces.el.PropertyResolver resolver)
Construct a new
PropertyResolver instance, wrapping the
specified instance using the Decorator pattern such that this class need
implement only the new functionality it supports, and not need to
re-implement the basic facilities. |
Modifier and Type | Method and Description |
---|---|
Class |
getType(Object base,
int index)
Return the
java.lang.Class representing the type of
value at the specified index of the specified base object, or
null if this value is null . |
Class |
getType(Object base,
Object name)
Return the
java.lang.Class representing the type of
the specified property of the specified base object, if it can be
determined; otherwise return null . |
Object |
getValue(Object base,
int index)
Return the value at the specified index of the specified
base object.
|
Object |
getValue(Object base,
Object name)
Return the value of the property with the specified name from
the specified base object.
|
boolean |
isReadOnly(Object base,
int index)
Return
true if the value at the specified index of
the specified base object is known to be immutable; otherwise,
return false . |
boolean |
isReadOnly(Object base,
Object name)
Return
true if the specified property of the specified
base object is known to be immutable; otherwise, return
false . |
void |
setValue(Object base,
int index,
Object value)
Set the value at the specified index of the specified
base object.
|
void |
setValue(Object base,
Object name,
Object value)
Set the specified value of the property with the specified name on
the specified base object.
|
public PropertyResolverImpl(javax.faces.el.PropertyResolver resolver)
Construct a new PropertyResolver
instance, wrapping the
specified instance using the Decorator pattern such that this class need
implement only the new functionality it supports, and not need to
re-implement the basic facilities.
resolver
- The original resolver to be wrappedNullPointerException
- if resolver
is null
public Object getValue(Object base, Object name) throws javax.faces.el.PropertyNotFoundException
Return the value of the property with the specified name from the specified base object.
getValue
in class javax.faces.el.PropertyResolver
base
- The base object whose property value is to be returnedname
- Name of the property to be returnedNullPointerException
- if base
or
name
is null
javax.faces.el.PropertyNotFoundException
- if the specified property name
does not exist, or is not readablepublic Object getValue(Object base, int index) throws javax.faces.el.PropertyNotFoundException
Return the value at the specified index of the specified base object.
getValue
in class javax.faces.el.PropertyResolver
base
- The base object whose property value is to be returnedindex
- Index of the value to returnIndexOutOfBoundsException
- if thrown by the underlying
access to the base objectNullPointerException
- if base
is null
javax.faces.el.PropertyNotFoundException
- if some other exception occurspublic void setValue(Object base, Object name, Object value) throws javax.faces.el.PropertyNotFoundException
Set the specified value of the property with the specified name on the specified base object.
setValue
in class javax.faces.el.PropertyResolver
base
- The base object whose property value is to be setname
- Name of the property to be setvalue
- Value of the property to be setNullPointerException
- if base
or
name
is null
javax.faces.el.PropertyNotFoundException
- if the specified property name
does not exist, or is not writeablepublic void setValue(Object base, int index, Object value) throws javax.faces.el.PropertyNotFoundException
Set the value at the specified index of the specified base object.
setValue
in class javax.faces.el.PropertyResolver
base
- The base object whose property value is to be setindex
- Index of the value to setvalue
- Value to be setIndexOutOfBoundsException
- if thrown by the underlying
access to the base objectNullPointerException
- if base
is null
javax.faces.el.PropertyNotFoundException
- if some other exception occurspublic boolean isReadOnly(Object base, Object name) throws javax.faces.el.PropertyNotFoundException
Return true
if the specified property of the specified
base object is known to be immutable; otherwise, return
false
.
isReadOnly
in class javax.faces.el.PropertyResolver
base
- The base object whose property is to analyzedname
- Name of the property to be analyzedNullPointerException
- if base
or
name
is null
javax.faces.el.PropertyNotFoundException
- if the specified property name
does not existpublic boolean isReadOnly(Object base, int index) throws javax.faces.el.PropertyNotFoundException
Return true
if the value at the specified index of
the specified base object is known to be immutable; otherwise,
return false
.
isReadOnly
in class javax.faces.el.PropertyResolver
base
- The base object whose property is to analyzedindex
- Index of the value whose type is to be returnedIndexOutOfBoundsException
- if thrown by the underlying
accessed to the indexed propertyNullPointerException
- if base
is null
javax.faces.el.PropertyNotFoundException
- if some other exception occurspublic Class getType(Object base, Object name) throws javax.faces.el.PropertyNotFoundException
Return the java.lang.Class
representing the type of
the specified property of the specified base object, if it can be
determined; otherwise return null
.
getType
in class javax.faces.el.PropertyResolver
base
- The base object whose property is to analyzedname
- Name of the property to be analyzedNullPointerException
- if base
or
name
is null
javax.faces.el.PropertyNotFoundException
- if the specified property name
does not existpublic Class getType(Object base, int index) throws javax.faces.el.PropertyNotFoundException
Return the java.lang.Class
representing the type of
value at the specified index of the specified base object, or
null
if this value is null
.
getType
in class javax.faces.el.PropertyResolver
base
- The base object whose property is to analyzedindex
- Index of the value whose type is to be returnedIndexOutOfBoundsException
- if thrown by the underlying
accessed to the indexed propertyNullPointerException
- if base
is null
javax.faces.el.PropertyNotFoundException
- if some other exception occursCopyright © 2000–2016 Apache Software Foundation. All rights reserved.