Class SharedRendererUtils
- java.lang.Object
-
- org.apache.myfaces.core.api.shared.SharedRendererUtils
-
public class SharedRendererUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description SharedRendererUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Converter
findUIOutputConverter(FacesContext facesContext, UIOutput component)
static Class<?>
getClassFromAttribute(FacesContext facesContext, Object attribute)
Gets a Class object from a given component attribute.static String
getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem)
Convenient utility method that returns the currently given SelectItem value as String, using the given converter.static String
getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, Object value)
Convenient utility method that returns the currently given value as String, using the given converter.static Object
getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component, String[] submittedValue)
static Object
getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component, String[] submittedValue, boolean considerValueType)
Gets the converted value of a UISelectMany component.static Converter
getSelectItemsValueConverter(Iterator<SelectItem> iterator, FacesContext facesContext)
Iterates through the SelectItems with the given Iterator and tries to obtain a by-class-converter based on the Class of SelectItem.getValue().static Converter
getValueTypeConverter(FacesContext facesContext, UISelectMany component)
Uses the valueType attribute of the given UISelectMany component to get a by-type converter.
-
-
-
Method Detail
-
findUIOutputConverter
public static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component)
-
getConvertedUISelectManyValue
public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component, String[] submittedValue) throws ConverterException
- Throws:
ConverterException
-
getConvertedUISelectManyValue
public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component, String[] submittedValue, boolean considerValueType) throws ConverterException
Gets the converted value of a UISelectMany component. If the considerValueType is true, this method will also consider the valueType attribute of Tomahawk UISelectMany components.- Parameters:
facesContext
-component
-submittedValue
-considerValueType
-- Returns:
- Throws:
ConverterException
-
getClassFromAttribute
public static Class<?> getClassFromAttribute(FacesContext facesContext, Object attribute) throws FacesException
Gets a Class object from a given component attribute. The attribute can be a ValueExpression (that evaluates to a String or a Class) or a String (that is a fully qualified Java class name) or a Class object.- Parameters:
facesContext
-attribute
-- Returns:
- Throws:
FacesException
- if the value is a String and the represented class cannot be found
-
getValueTypeConverter
public static Converter getValueTypeConverter(FacesContext facesContext, UISelectMany component)
Uses the valueType attribute of the given UISelectMany component to get a by-type converter.- Parameters:
facesContext
-component
-- Returns:
-
getSelectItemsValueConverter
public static Converter getSelectItemsValueConverter(Iterator<SelectItem> iterator, FacesContext facesContext)
Iterates through the SelectItems with the given Iterator and tries to obtain a by-class-converter based on the Class of SelectItem.getValue().- Parameters:
iterator
-facesContext
-- Returns:
- The first suitable Converter for the given SelectItems or null.
-
getConvertedStringValue
public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, Object value)
Convenient utility method that returns the currently given value as String, using the given converter. Especially usefull for dealing with primitive types.
-
getConvertedStringValue
public static String getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem)
Convenient utility method that returns the currently given SelectItem value as String, using the given converter. Especially usefull for dealing with primitive types.
-
-