org.apache.myfaces.trinidad.bean

## Interface FacesBean

- All Known Subinterfaces:
    UIXFacesBean
  All Known Implementing Classes:
    FacesBeanImpl, FacesBeanWrapper, UIXEditableFacesBeanImpl, UIXFacesBeanImpl

      public interface FacesBean

  Base interface for FacesBean storage objects.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `FacesBean.Type` Type of a FacesBean, encapsulating the set of registered PropertyKeys.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `Iterator<? extends 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.
    `Object` | `getProperty(PropertyKey key)` Returns a property.
    `Object` | `getRawProperty(PropertyKey key)` Gets the current unevaluated value for the specified property key.
    `FacesBean.Type` | `getType()` Returns the Type of this bean.
    `javax.faces.el.ValueBinding` | `getValueBinding(PropertyKey key)` Deprecated.
    `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.
    `void` | `setValueBinding(PropertyKey key, javax.faces.el.ValueBinding binding)` Deprecated.
    `void` | `setValueExpression(PropertyKey key, javax.el.ValueExpression expression)` Set the value expression for a key.

- - ### Method Detail

    - #### getType

          FacesBean.Type getType()

      Returns the Type of this bean.

    - #### getProperty

          Object getProperty(PropertyKey key)

      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.
      Parameters:
        `key` - the property key
      Throws:
        `IllegalArgumentException` - if key is a list key

    - #### setProperty

          void setProperty(PropertyKey key,
                         Object value)

      Set a property.
      Throws:
        `IllegalArgumentException` - if key is a list key

    - #### getLocalProperty

          Object getLocalProperty(PropertyKey key)

      Return a property, ignoring any value bindings.
      Throws:
        `IllegalArgumentException` - if key is a list key

    - #### getValueExpression

          javax.el.ValueExpression getValueExpression(PropertyKey key)

      Return the value expression for a key.
      Throws:
        `IllegalArgumentException` - if the property does not support value bindings.

    - #### getValueBinding

          javax.faces.el.ValueBinding getValueBinding(PropertyKey key)

      Deprecated.
      Return the value binding for a key.
      Throws:
        `IllegalArgumentException` - if the property does not support value bindings.

    - #### getRawProperty

          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 caller cannot ensure that FacesContext exists at the time of the call
      - The FacesContext does not yet contains the managed bean referenced by the value binding
      - The managed bean referenced by the value binding is not yet in a coherent state to evaluate the expression

      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.

      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.
      Throws:
        `IllegalArgumentException` - if the specified key is a list key.
      See Also:
        `getLocalProperty(PropertyKey)`, `getValueBinding(PropertyKey)`, `getValueExpression(PropertyKey)`

    - #### setValueExpression

          void setValueExpression(PropertyKey key,
                                javax.el.ValueExpression expression)

      Set the value expression for a key.
      Throws:
        `IllegalArgumentException` - if the property does not support value expressions.

    - #### setValueBinding

          void setValueBinding(PropertyKey key,
                             javax.faces.el.ValueBinding binding)

      Deprecated.
      Set the value binding for a key.
      Throws:
        `IllegalArgumentException` - if the property does not support value bindings.

    - #### addEntry

          void addEntry(PropertyKey listKey,
                      Object value)

      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.)
      Throws:
        `IllegalArgumentException` - if the key is not a list key.

    - #### removeEntry

          void removeEntry(PropertyKey listKey,
                         Object value)

      Remove an entry from a list.
      Throws:
        `IllegalArgumentException` - if the key is not a list key.

    - #### getEntries

          Object[] getEntries(PropertyKey listKey,
                            Class<?> clazz)

      Return as an array all elements of this key that are instances of the specified class.
      Returns:
        an array whose instance type is the class
      Throws:
        `IllegalArgumentException` - if the key is not a list key.

    - #### containsEntry

          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.
      Throws:
        `IllegalArgumentException` - if the key is not a list key.

    - #### entries

          Iterator<? extends Object> entries(PropertyKey listKey)

      Returns an iterator over all entries at this key.
      Throws:
        `IllegalArgumentException` - if the key is not a list key.

    - #### addAll

          void addAll(FacesBean from)

      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.

    - #### keySet

          Set<PropertyKey> keySet()

      Returns a Set of all PropertyKeys that have either lists or values attached.

    - #### bindingKeySet

          Set<PropertyKey> bindingKeySet()

      Returns a Set of all PropertyKeys that have ValueBindings attached.

    - #### markInitialState

          void markInitialState()

      use a delta tracking state going forward

    - #### initialStateMarked

          boolean initialStateMarked()

      Returns:
        true if delta state changes are being tracked, otherwise false

    - #### clearInitialState

          void clearInitialState()

      Reset to a non-delta tracking state.

    - #### saveState

          Object saveState(javax.faces.context.FacesContext context)

      Saves the state of a FacesBean.

    - #### restoreState

          void restoreState(javax.faces.context.FacesContext context,
                          Object state)

      Restores the state of a FacesBean.

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