org.apache.myfaces.commons.converter
Class ConverterBase

java.lang.Object
  extended by org.apache.myfaces.commons.converter.ConverterBase
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.convert.Converter
Direct Known Subclasses:
AbstractTypedNumberConverter

@JSFConverter(configExcluded=true,
              evaluateELOnExecution=true,
              tagClass="org.apache.myfaces.commons.converter.ConverterBaseTag",
              tagHandler="org.apache.myfaces.commons.converter.ConverterBaseTagHandler")
public abstract class ConverterBase
extends Object
implements javax.faces.component.StateHolder, javax.faces.convert.Converter

Base converter implementation for Apache MyFaces Commons Converters.


Constructor Summary
ConverterBase()
           
 
Method Summary
 String getDetailMessage()
          alternate conversion error detail message format string (use 'message' and 'detailMessage' alternatively)
protected  javax.faces.context.FacesContext getFacesContext()
           
protected  javax.faces.application.FacesMessage getFacesMessage(String defaultMessage, Object[] args)
           
protected  String getStringValue(javax.faces.context.FacesContext context, javax.el.ValueExpression vb)
           
 String getSummaryMessage()
          alternate conversion error summary message format string
 javax.el.ValueExpression getValueExpression(String name)
           
 boolean isTransient()
           
static Object restoreAttachedState(javax.faces.context.FacesContext context, Object stateObj)
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
static Object saveAttachedState(javax.faces.context.FacesContext context, Object attachedObject)
          Serializes objects which are "attached" to this component but which are not UIComponent children of it.
 Object saveState(javax.faces.context.FacesContext context)
           
 void setDetailMessage(String message)
           
 void setSummaryMessage(String message)
           
 void setTransient(boolean newTransientValue)
           
 void setValueExpression(String name, javax.el.ValueExpression binding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.convert.Converter
getAsObject, getAsString
 

Constructor Detail

ConverterBase

public ConverterBase()
Method Detail

getSummaryMessage

@JSFProperty
public String getSummaryMessage()
alternate conversion error summary message format string

Returns:
The summary message to be displayed

setSummaryMessage

public void setSummaryMessage(String message)
Parameters:
message - The summary message to be displayed.

getDetailMessage

@JSFProperty
public String getDetailMessage()
alternate conversion error detail message format string (use 'message' and 'detailMessage' alternatively)

Returns:
The detail message.

setDetailMessage

public void setDetailMessage(String message)
Parameters:
message - The detail message to be displayed.

saveState

public Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Parameters:
context -

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

getFacesMessage

protected javax.faces.application.FacesMessage getFacesMessage(String defaultMessage,
                                                               Object[] args)
Parameters:
defaultMessage - The default message we would expect.
args - Arguments for parsing this message.
Returns:
FacesMessage

getValueExpression

public javax.el.ValueExpression getValueExpression(String name)

setValueExpression

public void setValueExpression(String name,
                               javax.el.ValueExpression binding)

saveAttachedState

public static Object saveAttachedState(javax.faces.context.FacesContext context,
                                       Object attachedObject)
Serializes objects which are "attached" to this component but which are not UIComponent children of it. Examples are converter and listener objects. To be precise, it returns an object which implements java.io.Serializable, and which when serialized will persist the state of the provided object.

If the attachedObject is a List then every object in the list is saved via a call to this method, and the returned wrapper object contains a List object.

If the object implements StateHolder then the object's saveState is called immediately, and a wrapper is returned which contains both this saved state and the original class name. However in the case where the StateHolder.isTransient method returns true, null is returned instead.

If the object implements java.io.Serializable then the object is simply returned immediately; standard java serialization will later be used to store this object.

In all other cases, a wrapper is returned which simply stores the type of the provided object. When deserialized, a default instance of that type will be recreated.


restoreAttachedState

public static Object restoreAttachedState(javax.faces.context.FacesContext context,
                                          Object stateObj)
                                   throws IllegalStateException
Throws:
IllegalStateException

getFacesContext

protected javax.faces.context.FacesContext getFacesContext()

getStringValue

protected String getStringValue(javax.faces.context.FacesContext context,
                                javax.el.ValueExpression vb)


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.