Class CssTimeUtil



  • public class CssTimeUtil
    extends java.lang.Object
    a utility class for css time value manipulations.
    Since:
    1.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object[] getTimeValueAndUnit​(java.lang.String cssValue)
      gets the time value and unit as an array.
      static java.lang.Object[] getTimeValueAsPremitiveAndUnit​(java.lang.String cssValue)
      gets the time value and unit as an array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getTimeValueAsPremitiveAndUnit

        public static java.lang.Object[] getTimeValueAsPremitiveAndUnit​(java.lang.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 java.lang.Object[] getTimeValueAndUnit​(java.lang.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