Class DurationConverter

java.lang.Object
org.apache.myfaces.tobago.convert.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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
     

    Fields inherited from interface javax.faces.convert.Converter

    DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getAsObject​(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String string)
     
    getAsString​(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, Object object)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • DurationConverter

      public DurationConverter()
  • Method Details

    • 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