org.jboss.seam.ui.converter
Class ConverterChain

java.lang.Object
  extended by org.jboss.seam.ui.converter.ConverterChain
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.convert.Converter

public class ConverterChain
extends java.lang.Object
implements javax.faces.convert.Converter, javax.faces.component.StateHolder

This class provides a chainable converter for JSF. Any JSF converter can be placed at the end of the chain. A converter that is placed higher up the chain should return ConverterChain.CONTINUE if conversion has failed. If the all converters run return ConverterChain.CONTINUE an unconverted value will be returned. A converter can be placed in the chain with a priority, the order in which converters with the same priority is run is not specified.


Field Summary
static int CHAIN_END
          This places the converter at the end of the chain.
static int CHAIN_START
          This places the converter at the head of the chain.
static java.lang.String CONTINUE
           
 
Constructor Summary
ConverterChain()
           
ConverterChain(javax.faces.component.UIComponent component)
          Set up a ConverterChain for this component.
 
Method Summary
 boolean addConverterToChain(javax.faces.convert.Converter c)
          Add a converter to the end of the chain
 boolean addConverterToChain(javax.faces.convert.Converter c, int priority)
          Add a converter to the chain with a defined priority
 boolean addConverterToChain(javax.el.ValueExpression c)
          Add a converter to the end of the chain
 boolean addConverterToChain(javax.el.ValueExpression c, int priority)
          Add a converter to the chain with a defined priority
 boolean containsConverterType(javax.faces.convert.Converter converter)
           
 java.lang.Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String value)
           
 java.lang.String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
           
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setTransient(boolean newTransientValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTINUE

public static final java.lang.String CONTINUE
See Also:
Constant Field Values

CHAIN_END

public static final int CHAIN_END
This places the converter at the end of the chain. No garuntee is made about the order converters which are placed on the queue with this priority will be run

See Also:
Constant Field Values

CHAIN_START

public static final int CHAIN_START
This places the converter at the head of the chain. No garuntee is made about the order converters which are placed on the queue with this priority will be run

See Also:
Constant Field Values
Constructor Detail

ConverterChain

public ConverterChain()

ConverterChain

public ConverterChain(javax.faces.component.UIComponent component)
Set up a ConverterChain for this component. This replaces any existing converter with a ConverterChain with the existing Converter at the end of the chain

Parameters:
component -
Method Detail

getAsObject

public java.lang.Object getAsObject(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    java.lang.String value)
                             throws javax.faces.convert.ConverterException
Specified by:
getAsObject in interface javax.faces.convert.Converter
Throws:
javax.faces.convert.ConverterException

getAsString

public java.lang.String getAsString(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    java.lang.Object value)
                             throws javax.faces.convert.ConverterException
Specified by:
getAsString in interface javax.faces.convert.Converter
Throws:
javax.faces.convert.ConverterException

addConverterToChain

public boolean addConverterToChain(javax.faces.convert.Converter c)
Add a converter to the end of the chain


addConverterToChain

public boolean addConverterToChain(javax.el.ValueExpression c)
Add a converter to the end of the chain


addConverterToChain

public boolean addConverterToChain(javax.faces.convert.Converter c,
                                   int priority)
Add a converter to the chain with a defined priority


addConverterToChain

public boolean addConverterToChain(javax.el.ValueExpression c,
                                   int priority)
Add a converter to the chain with a defined priority


isTransient

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

restoreState

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

saveState

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

setTransient

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

containsConverterType

public boolean containsConverterType(javax.faces.convert.Converter converter)


Copyright © 2008. All Rights Reserved.