|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shale.validator.util.AbstractUtilities
public abstract class AbstractUtilities
Abstract base class for converters and validators that use Apache Commons Validator as their foundation. This class provides common utility methods for concrete converter and validator implementations.
Field Summary | |
---|---|
static String |
DEFAULT_RESOURCE_BUNDLE
Name of the resource bundle containing default message strings. |
Constructor Summary | |
---|---|
AbstractUtilities()
|
Method Summary | |
---|---|
String |
getMessage()
Return the custom error message template for this converter or validator, if any. |
boolean |
isTransient()
|
protected String |
message(javax.faces.context.FacesContext context,
String key)
Return a locale-sensitive message for this converter or validator. |
protected String |
message(javax.faces.context.FacesContext context,
String key,
Object[] parameters)
Retrieve a locale-specific message for the specified key, then treat it as a message format pattern, and substitute in the specified parameter values and return the resulting string. |
protected String |
message(Locale locale,
String message,
Object[] parameters)
Use the specified message as a message format pattern, substitute in the specified parameter values, and return the resulting string. |
void |
restoreState(javax.faces.context.FacesContext context,
Object state)
|
Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setMessage(String message)
Set the custom error message template for this validator. |
void |
setTransient(boolean transientValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_RESOURCE_BUNDLE
Name of the resource bundle containing default message strings.
Constructor Detail |
---|
public AbstractUtilities()
Method Detail |
---|
public String getMessage()
Return the custom error message template for this converter or validator, if any. If not defined, a standard error message template will be used instead.
public void setMessage(String message)
Set the custom error message template for this validator.
message
- The new custom error message template, or null
to select the standard templatepublic void restoreState(javax.faces.context.FacesContext context, Object state)
restoreState
in interface javax.faces.component.StateHolder
public Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
public boolean isTransient()
isTransient
in interface javax.faces.component.StateHolder
public void setTransient(boolean transientValue)
setTransient
in interface javax.faces.component.StateHolder
protected String message(javax.faces.context.FacesContext context, String key)
Return a locale-sensitive message for this converter or validator. The following algorithm is applied to select the appropriate message:
message
property has been set, use
that value explicitly
context
- FaceContext
for the current requestkey
- Message key for the requested messageprotected String message(javax.faces.context.FacesContext context, String key, Object[] parameters)
Retrieve a locale-specific message for the specified key, then treat it as a message format pattern, and substitute in the specified parameter values and return the resulting string.
context
- FaceContext
for the current requestkey
- Message key for the requested messageparameters
- Replacement parameters to substitute in to
the retrieved messageprotected String message(Locale locale, String message, Object[] parameters)
Use the specified message as a message format pattern, substitute in the specified parameter values, and return the resulting string.
locale
- Locale for performing parameter replacementmessage
- Message format pattern stringparameters
- Replacement parameters to substitute in to
the message format pattern
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |