Class PropertyEditorHelper


  • public class PropertyEditorHelper
    extends Object
    Helper class to aid the ConverterPropertyEditorBase in converting properties.
    Author:
    Mike Youngstrom
    • Constructor Detail

      • PropertyEditorHelper

        public PropertyEditorHelper​(Application app)
    • Method Detail

      • convertToObject

        public Object convertToObject​(Class<?> targetClass,
                                      String textValue)
        Convert the textValue to an object of type targetClass by delegating to a converter.
        Parameters:
        targetClass - the target class
        textValue - the text value
        Returns:
        the conversion result
      • convertToString

        public String convertToString​(Class<?> targetClass,
                                      Object value)
        Convert an object of type targetClass to text by delegating to a converter obtained from the Faces application.
        Parameters:
        targetClass - the target class
        value - the value
        Returns:
        the conversion result
      • getComponent

        protected UIComponent getComponent()
        Return the UIComponent that is currently being processed.
        Returns:
        the current component, or null.
      • addConversionErrorMessage

        protected void addConversionErrorMessage​(FacesContext context,
                                                 UIComponent component,
                                                 ConverterException ce)
        Add a conversion error message in the case of a PropertyEditor based conversion error.
        Parameters:
        context - the involved faces context
        component - the involved component
        ce - the converter exception