com.twitter.common.quantity
Enum Time

java.lang.Object
  extended by java.lang.Enum<Time>
      extended by com.twitter.common.quantity.Time
All Implemented Interfaces:
Unit<Time>, Serializable, Comparable<Time>

public enum Time
extends Enum<Time>
implements Unit<Time>

Provides a unit to allow conversions and unambiguous passing around of time Amounts.


Enum Constant Summary
DAYS
           
HOURS
           
MICROSECONDS
           
MILLISECONDS
           
MINUTES
           
NANOSECONDS
           
SECONDS
           
 
Method Summary
 TimeUnit getTimeUnit()
          Returns the equivalent TimeUnit.
 double multiplier()
          Returns the weight of this unit relative to other units in the same hierarchy.
 String toString()
           
static Time valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Time[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NANOSECONDS

public static final Time NANOSECONDS

MICROSECONDS

public static final Time MICROSECONDS

MILLISECONDS

public static final Time MILLISECONDS

SECONDS

public static final Time SECONDS

MINUTES

public static final Time MINUTES

HOURS

public static final Time HOURS

DAYS

public static final Time DAYS
Method Detail

values

public static Time[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Time c : Time.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Time valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

multiplier

public double multiplier()
Description copied from interface: Unit
Returns the weight of this unit relative to other units in the same hierarchy. Typically the smallest unit in the hierarchy returns 1, but this need not be the case. It is only required that each unit of the hierarchy return a multiplier relative to a common base unit for the hierarchy.

Specified by:
multiplier in interface Unit<Time>

getTimeUnit

public TimeUnit getTimeUnit()
Returns the equivalent TimeUnit.


toString

public String toString()
Overrides:
toString in class Enum<Time>