Class DurationConverter

  • All Implemented Interfaces:
    jakarta.faces.convert.Converter

    public class DurationConverter
    extends Object
    implements jakarta.faces.convert.Converter
    Converts durations. The duration value in the model is of type long. The string format must have one of this patterns:
    • hh:MM:ss
    • MM:ss
    • ss
    There may be an optional attribute "unit" in the component, which allows to set the unit of the model. The default unit is "millis".
    Examples
    input stringunitresulting long in modelRemark
    1:15milli75000
    1:15:00hour1Loosing 15 Minutes!
    1:15:00null4500000
    • Constructor Detail

      • DurationConverter

        public DurationConverter()
    • Method Detail

      • getAsString

        public String getAsString​(jakarta.faces.context.FacesContext facesContext,
                                  jakarta.faces.component.UIComponent component,
                                  Object object)
                           throws jakarta.faces.convert.ConverterException
        Specified by:
        getAsString in interface jakarta.faces.convert.Converter
        Throws:
        jakarta.faces.convert.ConverterException
      • getAsObject

        public Object getAsObject​(jakarta.faces.context.FacesContext facesContext,
                                  jakarta.faces.component.UIComponent component,
                                  String string)
                           throws jakarta.faces.convert.ConverterException
        Specified by:
        getAsObject in interface jakarta.faces.convert.Converter
        Throws:
        jakarta.faces.convert.ConverterException