org.apache.myfaces.trinidad.util

## Class LabeledFacesMessage

- java.lang.Object
- - javax.faces.application.FacesMessage
  - - org.apache.myfaces.trinidad.util.LabeledFacesMessage

- All Implemented Interfaces:
    Serializable

      public class LabeledFacesMessage
      extends javax.faces.application.FacesMessage

  Extension to FacesMessage which keeps track of the label on the component that generated the message. This implementation supports a label that is either a valueBinding or a String. If a valueBinding is provided, then the ability to serialize this FacesMessage may be suspect. We should not change this for historical reasons.

  If serialization is a must, and the ValueBindings need to be serialized BEFORE they are exchanged, then a version of the LabeledFacesMessage must be obtained using the `getLabeledFacesMessageWithLabelString(javax.faces.context.FacesContext)` method.
  Version:
    $Name: $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/util/LabeledFacesMessage.java#0 $) $Date: 10-nov-2005.19:08:38 $
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.faces.application.FacesMessage

      `javax.faces.application.FacesMessage.Severity`

  - ### Field Summary

    - ### Fields inherited from class javax.faces.application.FacesMessage

      `FACES_MESSAGES, SEVERITY_ERROR, SEVERITY_FATAL, SEVERITY_INFO, SEVERITY_WARN, VALUES, VALUES_MAP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LabeledFacesMessage()`
    `LabeledFacesMessage(javax.faces.application.FacesMessage.Severity severity, String summary, String detail)` Creates a LabeledFacesMessage without a pre-set label.
    `LabeledFacesMessage(javax.faces.application.FacesMessage.Severity severity, String summary, String detail, Object label)` Creates a LabeledFacesMessage with a label.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getLabel()` Returns the label, which can be either a String or a ValueBinding.
    `String` | `getLabelAsString(javax.faces.context.FacesContext context)` Gets a string representation of the label.
    `LabeledFacesMessage` | `getLabeledFacesMessageWithLabelString(javax.faces.context.FacesContext context)` Returns a LabeledFacesMessage object that is guarenteed to have a String as the label.
    `void` | `setLabel(Object label)` Sets the label, which can be either a String or a ValueBinding.

    - ### Methods inherited from class javax.faces.application.FacesMessage

      `getDetail, getSeverity, getSummary, isRendered, rendered, setDetail, setSeverity, setSummary`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LabeledFacesMessage

          public LabeledFacesMessage()

    - #### LabeledFacesMessage

          public LabeledFacesMessage(javax.faces.application.FacesMessage.Severity severity,
                             String summary,
                             String detail)

      Creates a LabeledFacesMessage without a pre-set label.
      Parameters:
        `severity` - the severity of the message
        `summary` - the message summary
        `detail` - the message detail

    - #### LabeledFacesMessage

          public LabeledFacesMessage(javax.faces.application.FacesMessage.Severity severity,
                             String summary,
                             String detail,
                             Object label)

      Creates a LabeledFacesMessage with a label.
      Parameters:
        `severity` - the severity of the message
        `summary` - the message summary
        `detail` - the message detail
        `label` - the message label - either a String or a ValueBinding

  - ### Method Detail

    - #### getLabel

          public Object getLabel()

      Returns the label, which can be either a String or a ValueBinding.

    - #### setLabel

          public void setLabel(Object label)

      Sets the label, which can be either a String or a ValueBinding.

    - #### getLabelAsString

          public String getLabelAsString(javax.faces.context.FacesContext context)

      Gets a string representation of the label. If the label is a ValueBinding, the expression is evaluated and the string value returned.

    - #### getLabeledFacesMessageWithLabelString

          public LabeledFacesMessage getLabeledFacesMessageWithLabelString(javax.faces.context.FacesContext context)

      Returns a LabeledFacesMessage object that is guarenteed to have a String as the label. If the label is already a String, this object will be returned. If it is not then a new LabeledFacesMessage will be created.

      By default the new LabeledFacesMessage will be created by calling
      Parameters:
        `context` -
      Returns:

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