Class DurationConverter

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

    public class DurationConverter
    extends Object
    implements javax.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​(javax.faces.context.FacesContext facesContext,
                                  javax.faces.component.UIComponent component,
                                  Object object)
                           throws javax.faces.convert.ConverterException
        Specified by:
        getAsString in interface javax.faces.convert.Converter
        Throws:
        javax.faces.convert.ConverterException
      • getAsObject

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