javax.cache
Class Configuration.Duration

java.lang.Object
  extended by javax.cache.Configuration.Duration
Enclosing interface:
Configuration<K,V>

public static class Configuration.Duration
extends Object

A time duration.


Field Summary
static Configuration.Duration ETERNAL
          ETERNAL (forever).
static Configuration.Duration ZERO
          ZERO (no time).
 
Constructor Summary
Configuration.Duration(long startTime, long endTime)
          Constructs a Configuration.Duration based on the duration between two specified points in time (since the Epoc), messured in milliseconds.
Configuration.Duration(TimeUnit timeUnit, long durationAmount)
          Constructs a duration.
 
Method Summary
 boolean equals(Object o)
          
 long getAdjustedTime(long time)
          Calculates the adjusted time (from the Epoc) given a specified time (to be adjusted) by the duration.
 long getDurationAmount()
           
 TimeUnit getTimeUnit()
           
 int hashCode()
          
 boolean isEternal()
          Determines if a Configuration.Duration is eternal (forever).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ETERNAL

public static final Configuration.Duration ETERNAL
ETERNAL (forever).


ZERO

public static final Configuration.Duration ZERO
ZERO (no time).

Constructor Detail

Configuration.Duration

public Configuration.Duration(TimeUnit timeUnit,
                              long durationAmount)
Constructs a duration.

Parameters:
timeUnit - the unit of time to specify time in. The minimum time unit is milliseconds.
durationAmount - how long, in the specified units, the cache entries should live. 0 means eternal.
Throws:
NullPointerException - if timeUnit is null
IllegalArgumentException - if durationAmount is less than 0 or a TimeUnit less than milliseconds is specified

Configuration.Duration

public Configuration.Duration(long startTime,
                              long endTime)
Constructs a Configuration.Duration based on the duration between two specified points in time (since the Epoc), messured in milliseconds.

Parameters:
startTime - the start time (since the Epoc)
endTime - the end time (since the Epoc)
Method Detail

getTimeUnit

public TimeUnit getTimeUnit()
Returns:
the TimeUnit used to specify this duration

getDurationAmount

public long getDurationAmount()
Returns:
the number of TimeUnits which quantify this duration

isEternal

public boolean isEternal()
Determines if a Configuration.Duration is eternal (forever).

Returns:
true if the Configuration.Duration is eternal

getAdjustedTime

public long getAdjustedTime(long time)
Calculates the adjusted time (from the Epoc) given a specified time (to be adjusted) by the duration.

Parameters:
time - the time from which to adjust given the duration
Returns:
the adjusted time

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2013. All Rights Reserved.