org.apache.myfaces.trinidad.bean
Class FacesBeanImpl

java.lang.Object
  extended by org.apache.myfaces.trinidad.bean.FacesBeanImpl
All Implemented Interfaces:
FacesBean
Direct Known Subclasses:
UIXFacesBeanImpl

public abstract class FacesBeanImpl
extends Object
implements FacesBean

Base implementation of FacesBean.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.myfaces.trinidad.bean.FacesBean
FacesBean.Type
 
Constructor Summary
FacesBeanImpl()
           
 
Method Summary
 void addAll(FacesBean from)
          Copies all properties, bindings, and list entries from one bean to another.
 void addEntry(PropertyKey listKey, Object value)
          Add an entry to a list.
 Set<PropertyKey> bindingKeySet()
          Returns a Set of all PropertyKeys that have ValueBindings attached.
 void clearInitialState()
          Reset to a non-delta tracking state.
 boolean containsEntry(PropertyKey listKey, Class<?> clazz)
          Return true if at least one element of the list identified by this key is an instance of the specified class.
protected  PropertyMap createExpressionsMap()
           
protected  PropertyMap createPropertyMap()
           
 Iterator<Object> entries(PropertyKey listKey)
          Returns an iterator over all entries at this key.
 Object[] getEntries(PropertyKey listKey, Class clazz)
          Return as an array all elements of this key that are instances of the specified class.
 Object getLocalProperty(PropertyKey key)
          Return a property, ignoring any value bindings.
protected  Object getLocalPropertyImpl(PropertyKey key)
           
 Object getProperty(PropertyKey key)
          Returns a property.
 Object getRawProperty(PropertyKey key)
          Gets the current unevaluated value for the specified property key.
abstract  FacesBean.Type getType()
          Get the type of a FacesBean
 javax.faces.el.ValueBinding getValueBinding(PropertyKey key)
          Return the value binding for a key.
 javax.el.ValueExpression getValueExpression(PropertyKey key)
          Return the value expression for a key.
 boolean initialStateMarked()
           
 Set<PropertyKey> keySet()
          Returns a Set of all PropertyKeys that have either lists or values attached.
 void markInitialState()
          use a delta tracking state going forward
 void removeEntry(PropertyKey listKey, Object value)
          Remove an entry from a list.
 void restoreState(javax.faces.context.FacesContext context, Object state)
          Restores the state of a FacesBean.
 Object saveState(javax.faces.context.FacesContext context)
          Saves the state of a FacesBean.
 void setProperty(PropertyKey key, Object value)
          Set a property.
protected  void setPropertyImpl(PropertyKey key, Object value)
           
 void setValueBinding(PropertyKey key, javax.faces.el.ValueBinding binding)
          Set the value binding for a key.
 void setValueExpression(PropertyKey key, javax.el.ValueExpression expression)
          Set the value expression for a key.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FacesBeanImpl

public FacesBeanImpl()
Method Detail

getType

public abstract FacesBean.Type getType()
Get the type of a FacesBean

Specified by:
getType in interface FacesBean

getProperty

public final Object getProperty(PropertyKey key)
Description copied from interface: FacesBean
Returns a property. If the property has not been explicitly set, and the key supports bindings, and a ValueBinding has been set for this key, that ValueBinding will be evaluated.

Specified by:
getProperty in interface FacesBean
Parameters:
key - the property key

getRawProperty

public final Object getRawProperty(PropertyKey key)
Gets the current unevaluated value for the specified property key.

The method will first look for a local value. If it exists, it will be returned. If it does not and the bean supports value expressions, the method will look for an expression with the specified key and return it directly if it exists without evaluatig its value.

This method is mainly used when:

The most common use case of this method is for message attributes set on converters and validators using a value binding referencing a managed bean created by <f:loadBundle/>. Since loadBundle only creates its bean during the render response phase while converter and validators take action during process validation phase, the message property's value binding must be stored in a special FacesMessage implementation that will evaluate the binding only during render response.

Specified by:
getRawProperty in interface FacesBean
Parameters:
key - the parameter key of the raw property value to get.
Returns:
the local value of the specified key if it exists, a ValueExpression object if the specified key supports expressions and an expression was specified for that property, null otherwise.
See Also:
FacesBean.getLocalProperty(PropertyKey), FacesBean.getValueBinding(PropertyKey), FacesBean.getValueExpression(PropertyKey)

setProperty

public void setProperty(PropertyKey key,
                        Object value)
Description copied from interface: FacesBean
Set a property.

Specified by:
setProperty in interface FacesBean

getLocalProperty

public final Object getLocalProperty(PropertyKey key)
Description copied from interface: FacesBean
Return a property, ignoring any value bindings.

Specified by:
getLocalProperty in interface FacesBean

getValueExpression

public final javax.el.ValueExpression getValueExpression(PropertyKey key)
Description copied from interface: FacesBean
Return the value expression for a key.

Specified by:
getValueExpression in interface FacesBean

setValueExpression

public final void setValueExpression(PropertyKey key,
                                     javax.el.ValueExpression expression)
Description copied from interface: FacesBean
Set the value expression for a key.

Specified by:
setValueExpression in interface FacesBean

getValueBinding

public final javax.faces.el.ValueBinding getValueBinding(PropertyKey key)
Description copied from interface: FacesBean
Return the value binding for a key.

Specified by:
getValueBinding in interface FacesBean

setValueBinding

public final void setValueBinding(PropertyKey key,
                                  javax.faces.el.ValueBinding binding)
Description copied from interface: FacesBean
Set the value binding for a key.

Specified by:
setValueBinding in interface FacesBean

addEntry

public final void addEntry(PropertyKey listKey,
                           Object value)
Description copied from interface: FacesBean
Add an entry to a list. The same value may be added repeatedly; null is also a legal value. (Consumers of this API can apply more stringent rules to specific keys in cover functions.)

Specified by:
addEntry in interface FacesBean

removeEntry

public final void removeEntry(PropertyKey listKey,
                              Object value)
Description copied from interface: FacesBean
Remove an entry from a list.

Specified by:
removeEntry in interface FacesBean

getEntries

public final Object[] getEntries(PropertyKey listKey,
                                 Class clazz)
Description copied from interface: FacesBean
Return as an array all elements of this key that are instances of the specified class.

Specified by:
getEntries in interface FacesBean
Returns:
an array whose instance type is the class

containsEntry

public final boolean containsEntry(PropertyKey listKey,
                                   Class<?> clazz)
Description copied from interface: FacesBean
Return true if at least one element of the list identified by this key is an instance of the specified class.

Specified by:
containsEntry in interface FacesBean

entries

public final Iterator<Object> entries(PropertyKey listKey)
Description copied from interface: FacesBean
Returns an iterator over all entries at this key.

Specified by:
entries in interface FacesBean

addAll

public void addAll(FacesBean from)
Description copied from interface: FacesBean
Copies all properties, bindings, and list entries from one bean to another. If the beans are of different types, properties will be copied by name. Incompatible properties will be ignored; specifically, properties that are lists on only one of the beans or ValueBindings on the original bean that are not allowed on the target bean.

Specified by:
addAll in interface FacesBean

keySet

public Set<PropertyKey> keySet()
Description copied from interface: FacesBean
Returns a Set of all PropertyKeys that have either lists or values attached.

Specified by:
keySet in interface FacesBean

bindingKeySet

public final Set<PropertyKey> bindingKeySet()
Description copied from interface: FacesBean
Returns a Set of all PropertyKeys that have ValueBindings attached.

Specified by:
bindingKeySet in interface FacesBean

markInitialState

public void markInitialState()
Description copied from interface: FacesBean
use a delta tracking state going forward

Specified by:
markInitialState in interface FacesBean

clearInitialState

public void clearInitialState()
Description copied from interface: FacesBean
Reset to a non-delta tracking state.

Specified by:
clearInitialState in interface FacesBean

initialStateMarked

public boolean initialStateMarked()
Specified by:
initialStateMarked in interface FacesBean
Returns:
true if delta state changes are being tracked, otherwise false

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
Description copied from interface: FacesBean
Restores the state of a FacesBean.

Specified by:
restoreState in interface FacesBean

saveState

public Object saveState(javax.faces.context.FacesContext context)
Description copied from interface: FacesBean
Saves the state of a FacesBean.

Specified by:
saveState in interface FacesBean

toString

public String toString()
Overrides:
toString in class Object

setPropertyImpl

protected void setPropertyImpl(PropertyKey key,
                               Object value)

getLocalPropertyImpl

protected Object getLocalPropertyImpl(PropertyKey key)

createPropertyMap

protected PropertyMap createPropertyMap()

createExpressionsMap

protected PropertyMap createExpressionsMap()


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.