Top Description Inners Fields Constructors Methods
com.sun.faces.ext.component

public Class MessageFactory

extends Object
Class Inheritance
Imports
java.text.MessageFormat, java.util.Locale, .MissingResourceException, .ResourceBundle, jakarta.el.ValueExpression, jakarta.faces.FactoryFinder, jakarta.faces.application.Application, .ApplicationFactory, .FacesMessage, jakarta.faces.component.UIComponent, jakarta.faces.context.FacesContext

supported filters: package and protection.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
MessageFactory.BindingFacesMessage

This class overrides FacesMessage to provide the evaluation of binding expressions in addition to Strings.

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Application
private static ClassLoader
getCurrentLoader(Class<T> fallbackClass)

public static Object

Returns:

the label, if any, of the component
getLabel
(FacesContext
- the FacesContext for the current request
context
,
UIComponent
- the component of interest
component
)

Returns the label property from the specified component.

public static FacesMessage

Returns:

a localized FacesMessage with the severity of FacesMessage.SEVERITY_ERROR
getMessage
(FacesContext
- the FacesContext for the current request
context
,
String
- the key of the message in the resource bundle
messageId
,
Object...
- substittion parameters
params
)

Creates and returns a FacesMessage for the specified Locale.

private static FacesMessage

Returns:

a localized FacesMessage with the severity of FacesMessage.SEVERITY_ERROR
getMessage
(Locale
- the target Locale
locale
,
String
- the key of the message in the resource bundle
messageId
,
Object...
- substittion parameters
params
)

Creates and returns a FacesMessage for the specified Locale.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MOJARRA_RESOURCE_BASENAMEback to summary
private static final String MOJARRA_RESOURCE_BASENAME

Constructor Detail

MessageFactoryback to summary
private MessageFactory()

Method Detail

getApplicationback to summary
private static Application getApplication()
getCurrentLoaderback to summary
private static ClassLoader getCurrentLoader(Class<T> fallbackClass)
getLabelback to summary
public static Object getLabel(FacesContext context, UIComponent component)

Returns the label property from the specified component.

Parameters
context:FacesContext

- the FacesContext for the current request

component:UIComponent

- the component of interest

Returns:Object

the label, if any, of the component

getMessageback to summary
public static FacesMessage getMessage(FacesContext context, String messageId, Object... params)

Creates and returns a FacesMessage for the specified Locale.

Parameters
context:FacesContext

- the FacesContext for the current request

messageId:String

- the key of the message in the resource bundle

params:Object[]

- substittion parameters

Returns:FacesMessage

a localized FacesMessage with the severity of FacesMessage.SEVERITY_ERROR

getMessageback to summary
private static FacesMessage getMessage(Locale locale, String messageId, Object... params)

Creates and returns a FacesMessage for the specified Locale.

Parameters
locale:Locale

- the target Locale

messageId:String

- the key of the message in the resource bundle

params:Object[]

- substittion parameters

Returns:FacesMessage

a localized FacesMessage with the severity of FacesMessage.SEVERITY_ERROR

com.sun.faces.ext.component back to summary

pack-priv Class MessageFactory.BindingFacesMessage

extends FacesMessage
Class Inheritance

This class overrides FacesMessage to provide the evaluation of binding expressions in addition to Strings. It is often the case, that a binding expression may reference a localized property value that would be used as a substitution parameter in the message. For example: #{bundle.userLabel} "bundle" may not be available until the page is rendered. The "late" binding evaluation in getSummary and getDetail allow the expression to be evaluated when that property is available.

Field Summary

Modifier and TypeField and Description
private Locale
private Object[]
private Object[]
private static final long
Inherited from jakarta.faces.application.FacesMessage:
FACES_MESSAGESSEVERITY_ERRORSEVERITY_FATALSEVERITY_INFOSEVERITY_WARNVALUESVALUES_MAP

Constructor Summary

AccessConstructor and Description
pack-priv
BindingFacesMessage(Locale locale, String messageFormat, String detailMessageFormat, Object[] parameters)

Method Summary

Modifier and TypeMethod and Description
public String
getDetail()

Overrides jakarta.faces.application.FacesMessage.getDetail.

Return the localized detail text.

private String
getFormattedString(String msgtext, Object[] params)

public String
getSummary()

Overrides jakarta.faces.application.FacesMessage.getSummary.

Return the localized summary text.

private void
Inherited from jakarta.faces.application.FacesMessage:
equalsgetSeverityhashCodeisRenderedrenderedsetDetailsetSeveritysetSummarytoString

Field Detail

localeback to summary
private Locale locale
parametersback to summary
private Object[] parameters
resolvedParametersback to summary
private Object[] resolvedParameters
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.faces.application.FacesMessage.serialVersionUID.

Constructor Detail

BindingFacesMessageback to summary
pack-priv BindingFacesMessage(Locale locale, String messageFormat, String detailMessageFormat, Object[] parameters)

Method Detail

getDetailback to summary
public String getDetail()

Overrides jakarta.faces.application.FacesMessage.getDetail.

Doc from jakarta.faces.application.FacesMessage.getDetail.

Return the localized detail text. If no localized detail text has been defined for this message, return the localized summary text instead.

Returns:String

the localized detail text.

Annotations
@Override
getFormattedStringback to summary
private String getFormattedString(String msgtext, Object[] params)
getSummaryback to summary
public String getSummary()

Overrides jakarta.faces.application.FacesMessage.getSummary.

Doc from jakarta.faces.application.FacesMessage.getSummary.

Return the localized summary text.

Returns:String

the localized summary text.

Annotations
@Override
resolveBindingsback to summary
private void resolveBindings()