| java.lang.Object com.sun.rave.web.ui.util.ConversionUtilities
ConversionUtilities | public class ConversionUtilities (Code) | | 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.
|
Method Summary | |
public static Object | convertRenderedValue(FacesContext context, Object submittedValue, UIComponent component) Return the converted value of submittedValue.
If submittedValue is null, return null.
If submittedValue is "", check the rendered value. | public static Object | convertValueToArray(UIComponent component, String[] rawValues, FacesContext context) Convert a String array of submitted values to the appropriate
type of Array for the value Object. | public static Object | convertValueToList(UIComponent component, String[] rawValues, FacesContext context) Convert a String array of submitted values to the appropriate
type of List for the value Object. | public static Object | convertValueToObject(UIComponent component, String rawValue, FacesContext context) Convert the values of a component with a
single (non-list, non-array) value. | public static String | convertValueToString(UIComponent component, 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. | public static Converter | getConverterForClass(Class converterClass) This method retrieves an appropriate converter based on the
type of an object. | static void | log(String s) | public static void | removeRenderedValue(UIComponent component) Remove the stored rendered value from the specified component. | public static void | removeSavedRenderedValueState(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. | public static boolean | renderedNull(UIComponent component) Return true if the stored rendered value on the specified
component was null. | public static void | restoreRenderedValueState(FacesContext context, UIComponent component) Used to restore the rendered value when a component is
used within a table. | public static void | saveRenderedValueState(FacesContext context, UIComponent component) Used to preserve the rendered value when a component is
used within a table. | public static void | setRenderedValue(UIComponent component, Object value) Record the value being rendered. |
convertRenderedValue | public static Object convertRenderedValue(FacesContext context, Object submittedValue, UIComponent component) throws ConverterException(Code) | | Return the converted value of submittedValue.
If submittedValue is null, return null.
If submittedValue is "", check the rendered value. If the
the value that was rendered was null, return null
else continue to convert.
|
convertValueToArray | public static Object convertValueToArray(UIComponent component, String[] rawValues, FacesContext context) throws ConverterException(Code) | | 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.
Parameters: component - The component whose submitted values are to beconverted Parameters: rawValues - The submitted value of the component Parameters: context - The FacesContext of the request See Also: ValueTypeEvaluator throws: ConverterException - if the conversion fails An array of converted values |
convertValueToList | public static Object convertValueToList(UIComponent component, String[] rawValues, FacesContext context) throws ConverterException(Code) | | 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.
Parameters: component - The component whose submitted values are to beconverted Parameters: rawValues - The submitted value of the component Parameters: context - The FacesContext of the request See Also: ValueTypeEvaluator throws: ConverterException - if the conversion fails A List of converted values |
convertValueToObject | public static Object convertValueToObject(UIComponent component, String rawValue, FacesContext context) throws ConverterException(Code) | | Convert the values of a component with a
single (non-list, non-array) value. Use this
method if
- the component always binds the user input to
a single object (e.g. a textfield component);
or
- to handle the single object case when the
component may bind the user input to a single
object or to a collection of
objects (e.g. a list component). Use a
ValueTypeEvaluator to evaluate the value
binding type.
Parameters: component - The component whose value is getting converted Parameters: rawValue - The submitted value of the component Parameters: context - The FacesContext of the request throws: ConverterException - if the conversion fails An Object representing the converted value. If rawValue ==null return null. See Also: ValueTypeEvaluator |
convertValueToString | public static String convertValueToString(UIComponent component, Object realValue) throws ConverterException(Code) | | Converts an Object (which may or may not be the value of the
component) to a String using the converter associated
with the component. This method can be used to convert the
value of the component, or the value of an Object associated
with the component, such as the objects representing the
options for a listbox or a checkboxgroup.
Parameters: component - The component that needs to display the valueas a String Parameters: realValue - The object that the component is to display throws: ConverterException - if the conversion fails If converting the Object to a String fails |
getConverterForClass | public static Converter getConverterForClass(Class converterClass)(Code) | | This method retrieves an appropriate converter based on the
type of an object.
Parameters: converterClass - The name of the converter class An instance of the appropriate converter type |
removeRenderedValue | public static void removeRenderedValue(UIComponent component)(Code) | | Remove the stored rendered value from the specified component.
|
removeSavedRenderedValueState | public static void removeSavedRenderedValueState(UIComponent component)(Code) | | 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.
|
renderedNull | public static boolean renderedNull(UIComponent component)(Code) | | Return true if the stored rendered value on the specified
component was null.
|
restoreRenderedValueState | public static void restoreRenderedValueState(FacesContext context, UIComponent component)(Code) | | Used to restore the rendered value when a component is
used within a table. Since there is only one component
instance when used in a table column the rendered value
must be maintained and restored for each "virtual" component
instance for the rows in the column.
Parameters: context - The current FacesContext for this request. Parameters: component - The component that is appearing in the table. |
saveRenderedValueState | public static void saveRenderedValueState(FacesContext context, UIComponent component)(Code) | | Used to preserve the rendered value when a component is
used within a table. Since there is only one component
instance when used in a table column the rendered value
must be maintained for each "virtual" component instance
for the rows in the column.
Parameters: context - The current FacesContext for this request. Parameters: component - The component that is appearing in the table. |
setRenderedValue | public static void setRenderedValue(UIComponent component, Object value)(Code) | | Record the value being rendered.
Parameters: component - The component being rendered. Parameters: value - The value being rendered. |
|
|