|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.rave.web.ui.util.ConversionUtilities
public class ConversionUtilities
The ConversionUtilities class provides utility method for converting values to and from Strings. Use this class if your component processes input from the user, or displays a converted value.
Constructor Summary | |
---|---|
ConversionUtilities()
|
Method Summary | |
---|---|
static java.lang.Object |
convertRenderedValue(javax.faces.context.FacesContext context,
java.lang.Object submittedValue,
javax.faces.component.UIComponent component)
Return the converted value of submittedValue. |
static java.lang.Object |
convertValueToArray(javax.faces.component.UIComponent component,
java.lang.String[] rawValues,
javax.faces.context.FacesContext context)
Convert a String array of submitted values to the appropriate type of Array for the value Object. |
static java.lang.Object |
convertValueToList(javax.faces.component.UIComponent component,
java.lang.String[] rawValues,
javax.faces.context.FacesContext context)
Convert a String array of submitted values to the appropriate type of List for the value Object. |
static java.lang.Object |
convertValueToObject(javax.faces.component.UIComponent component,
java.lang.String rawValue,
javax.faces.context.FacesContext context)
Convert the values of a component with a single (non-list, non-array) value. |
static java.lang.String |
convertValueToString(javax.faces.component.UIComponent component,
java.lang.Object realValue)
Converts an Object (which may or may not be the value of the component) to a String using the converter associated with the component. |
static javax.faces.convert.Converter |
getConverterForClass(java.lang.Class converterClass)
This method retrieves an appropriate converter based on the type of an object. |
static void |
removeRenderedValue(javax.faces.component.UIComponent component)
Remove the stored rendered value from the specified component. |
static void |
removeSavedRenderedValueState(javax.faces.component.UIComponent component)
Remove the storage for the "virtual" for the specified component used to save the rendered value for the "virtual" instances of this component when used in a table. |
static boolean |
renderedNull(javax.faces.component.UIComponent component)
Return true if the stored rendered value on the specified component was null. |
static void |
restoreRenderedValueState(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Used to restore the rendered value when a component is used within a table. |
static void |
saveRenderedValueState(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Used to preserve the rendered value when a component is used within a table. |
static void |
setRenderedValue(javax.faces.component.UIComponent component,
java.lang.Object value)
Record the value being rendered. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConversionUtilities()
Method Detail |
---|
public static java.lang.Object convertValueToObject(javax.faces.component.UIComponent component, java.lang.String rawValue, javax.faces.context.FacesContext context) throws javax.faces.convert.ConverterException
Convert the values of a component with a single (non-list, non-array) value. Use this method if
component
- The component whose value is getting convertedrawValue
- The submitted value of the componentcontext
- The FacesContext of the request
null
return null.
javax.faces.convert.ConverterException
- if the conversion failsValueTypeEvaluator
public static java.lang.Object convertValueToArray(javax.faces.component.UIComponent component, java.lang.String[] rawValues, javax.faces.context.FacesContext context) throws javax.faces.convert.ConverterException
Convert a String array of submitted values to the appropriate type of Array for the value Object. This method assumes that the value binding for the value of the component has been determined to be an array (and as a consequence that the component implements ValueHolder).
To evaluate the valueBinding, use the ValueTypeEvaluator class.
component
- The component whose submitted values are to be
convertedrawValues
- The submitted value of the componentcontext
- The FacesContext of the request
javax.faces.convert.ConverterException
- if the conversion failsValueTypeEvaluator
public static java.lang.Object convertValueToList(javax.faces.component.UIComponent component, java.lang.String[] rawValues, javax.faces.context.FacesContext context) throws javax.faces.convert.ConverterException
Convert a String array of submitted values to the appropriate type of List for the value Object. This method assumes that the value binding for the value of the component has been determined to be a subclass of java.util.List, and as a consequence, that the component implements ValueHolder.
To evaluate the valueBinding, use the ValueTypeEvaluator class.
component
- The component whose submitted values are to be
convertedrawValues
- The submitted value of the componentcontext
- The FacesContext of the request
javax.faces.convert.ConverterException
- if the conversion failsValueTypeEvaluator
public static java.lang.String convertValueToString(javax.faces.component.UIComponent component, java.lang.Object realValue) throws javax.faces.convert.ConverterException
component
- The component that needs to display the value
as a StringrealValue
- The object that the component is to display
javax.faces.convert.ConverterException
- if the conversion failspublic static javax.faces.convert.Converter getConverterForClass(java.lang.Class converterClass)
converterClass
- The name of the converter class
public static java.lang.Object convertRenderedValue(javax.faces.context.FacesContext context, java.lang.Object submittedValue, javax.faces.component.UIComponent component) throws javax.faces.convert.ConverterException
javax.faces.convert.ConverterException
public static void setRenderedValue(javax.faces.component.UIComponent component, java.lang.Object value)
component
- The component being rendered.value
- The value being rendered.public static boolean renderedNull(javax.faces.component.UIComponent component)
public static void removeRenderedValue(javax.faces.component.UIComponent component)
public static void saveRenderedValueState(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- The current FacesContext for this request.component
- The component that is appearing in the table.public static void restoreRenderedValueState(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- The current FacesContext for this request.component
- The component that is appearing in the table.public static void removeSavedRenderedValueState(javax.faces.component.UIComponent component)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |