Package com.webmethods.caf.faces.convert
Class ConvertUtils
java.lang.Object
com.webmethods.caf.faces.convert.ConvertUtils
Helper functions for converting values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
doubleValue
(Object o, double defaultValue) Converts o to a double.static Locale
getLocalFromToString
(String sLocale) Convert an Locale.toString() text to a Locale Object.static Class<?>
getPrimitiveType
(String type) Gets class for primitive type name (ieBoolean
for "boolean").static int
Converts o to an int.static boolean
True if s is null or empty string (""); false otherwise.static boolean
True if o is Boolean.FALSE or "false" or "FALSE".static boolean
isPrimitiveType
(String type) True if type name is a primitive type (ie "boolean").static boolean
True if o is Boolean.TRUE or "true" or "TRUE".static String
Converts o to a string.static String
toString
(FacesContext context, UIComponent component, Object value) Converts specified component value to a string, using component's converter.
-
Constructor Details
-
ConvertUtils
public ConvertUtils()
-
-
Method Details
-
isTrue
True if o is Boolean.TRUE or "true" or "TRUE". False if o is null or any other value. -
isFalse
True if o is Boolean.FALSE or "false" or "FALSE". False if o is null or any other value. -
toString
Converts o to a string. If o is null, returns empty string (""). -
toString
public static String toString(FacesContext context, UIComponent component, Object value) throws ConverterException Converts specified component value to a string, using component's converter. Nulls are converted to empty strings ("").- Parameters:
context
- Current context.component
- Component for which to conver the value.value
- Value to convert.- Returns:
- String representation of value.
- Throws:
ConverterException
-
isEmpty
True if s is null or empty string (""); false otherwise. -
intValue
Converts o to an int. If o is null or not convertable, returns defaultValue. -
doubleValue
Converts o to a double. If o is null or not convertable, returns defaultValue. -
isPrimitiveType
True if type name is a primitive type (ie "boolean"). -
getPrimitiveType
Gets class for primitive type name (ieBoolean
for "boolean"). -
getLocalFromToString
Convert an Locale.toString() text to a Locale Object.- Parameters:
sLocale
- from a Locale.toString() output.- Returns:
- a Locale Object. Throws NullPointerException if input is null.
-