Class CssTimeUtil

java.lang.Object
com.webfirmframework.wffweb.util.CssTimeUtil

public final class CssTimeUtil extends Object
a utility class for css time value manipulations.
Since:
1.0.0
  • Method Details

    • getTimeValueAsPremitiveAndUnit

      public static Object[] getTimeValueAsPremitiveAndUnit(String cssValue)
      gets the time value and unit as an array. For a cssValue 555ms, the returned array may be used as
       Object[] timeValueAsPremitiveAndUnit = CssTimeUtil.getTimeValueAsPremitiveAndUnit("555ms");
       float value = (float) timeValueAsPremitiveAndUnit[0];
      
       // the object will be equal to CssTimeUnit.MS
       CssTimeUnit unit = (CssTimeUnit) timeValueAsPremitiveAndUnit[1];
       
      Parameters:
      cssValue - the value from which the time value and unit required to be parsed, Eg:- 555ms.
      Returns:
      an array containing time and unit. The time will be in the zeroth index as float (primitive type) type and its unit in the first index as an object of CssTimeUnit. If the given cssValue is not a combination of time value and unit then an empty array (having time zero) will be returned. It will never return null.
      Since:
      1.0.0
    • getTimeValueAndUnit

      public static Object[] getTimeValueAndUnit(String cssValue)
      gets the time value and unit as an array. For a cssValue 555ms, the returned array may be used as
       Object[] timeValueAndUnit = CssTimeUtil.getTimeValueAndUnit("555ms");
       Float value = (Float) timeValueAndUnit[0];
      
       // the object will be equal to CssTimeUnit.MS
       CssTimeUnit unit = (CssTimeUnit) timeValueAndUnit[1];
       
      Parameters:
      cssValue - the value from which the time value and unit required to be parsed, Eg:- 555ms.
      Returns:
      an array containing time and unit. The time will be in the zeroth index as Float (wrapper type) type and its unit in the first index as an object of CssTimeUnit. If the given cssValue is not a combination of time value and unit then an empty array (having time zero) will be returned. It will never return null.
      Since:
      1.0.0