public class Deadline extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DATE_FORMAT
The format used for parsing and formatting dates.
|
static Deadline |
MAX_VALUE
The maximum (longest-lived) deadline.
|
static Deadline |
MIN_VALUE
The minimum (shortest-lived) deadline.
|
Modifier and Type | Method and Description |
---|---|
static Deadline |
calculate(long timeMillis,
TimeValue timeValue)
Calculates a deadline with a given time in milliseconds plus a given time value.
|
static Deadline |
calculate(TimeValue timeValue)
Calculates a deadline from now plus a given time value.
|
boolean |
equals(Object obj) |
String |
format(TimeUnit overdueTimeUnit)
Formats this deadline.
|
String |
formatTarget()
Formats the deadline value as a string in the format "yyyy-MM-dd\'T\'HH:mm:ss.SSSZ".
|
Deadline |
freeze() |
static Deadline |
fromUnixMilliseconds(long value)
Creates a deadline from a UNIX time in milliseconds.
|
long |
getValue()
Gets the UNIX time deadline value.
|
int |
hashCode() |
boolean |
isBefore(long millis)
Returns whether this deadline occurs before the given time in milliseconds.
|
boolean |
isExpired()
Returns whether the deadline has expired.
|
boolean |
isMax()
Returns whether this deadline is the maximum deadline.
|
boolean |
isMin()
Returns whether this deadline is the minimum deadline.
|
boolean |
isNotExpired()
Returns whether this deadline has not expired.
|
Deadline |
min(Deadline other)
Returns the smaller of this and another
Deadline . |
static Deadline |
parse(String source)
Creates a deadline from a string in the format "yyyy-MM-dd\'T\'HH:mm:ss.SSSZ".
|
long |
remaining()
Returns the difference in milliseconds between the deadline and now.
|
TimeValue |
remainingTimeValue()
Returns the difference as a TimeValue between the deadline and now.
|
String |
toString() |
public static final String DATE_FORMAT
public static Deadline MAX_VALUE
public static Deadline MIN_VALUE
public static Deadline calculate(long timeMillis, TimeValue timeValue)
timeMillis
- A time in UNIX milliseconds, usually the current time.timeValue
- time value to add to timeMillis
.public static Deadline calculate(TimeValue timeValue)
timeValue
- time value to add to timeMillis
.public static Deadline fromUnixMilliseconds(long value)
value
- a UNIX time in milliseconds.public static Deadline parse(String source) throws ParseException
source
- a string in the format "yyyy-MM-dd\'T\'HH:mm:ss.SSSZ".ParseException
- if the specified source string cannot be parsed.public String format(TimeUnit overdueTimeUnit)
overdueTimeUnit
- the time unit to show how much over the deadline we are.public String formatTarget()
public Deadline freeze()
public long getValue()
public boolean isBefore(long millis)
millis
- the time to compare.public boolean isExpired()
public boolean isMax()
public boolean isMin()
public boolean isNotExpired()
public Deadline min(Deadline other)
Deadline
.other
- another deadline.this
and other
.public long remaining()
public TimeValue remainingTimeValue()
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.