Classes | |
enum | DurationComparator |
Static Public Member Functions | |
static Duration | add (Duration d1, Duration d2) |
static Duration | add (Duration d1, Duration d2) |
static Duration | checkNotNegative (Duration duration) |
static Duration | checkNotNegative (Duration duration) |
static Duration | checkPositive (Duration duration) |
static Duration | checkPositive (Duration duration) |
static Duration | checkValid (Duration duration) |
static Duration | checkValid (Duration duration) |
static Duration | checkValid (Duration.Builder durationBuilder) |
static Duration | checkValid (Duration.Builder durationBuilder) |
static Comparator< Duration > | comparator () |
static Comparator< Duration > | comparator () |
static int | compare (Duration x, Duration y) |
static int | compare (Duration x, Duration y) |
static Duration | fromDays (long days) |
static Duration | fromDays (long days) |
static Duration | fromHours (long hours) |
static Duration | fromHours (long hours) |
static Duration | fromMicros (long microseconds) |
static Duration | fromMicros (long microseconds) |
static Duration | fromMillis (long milliseconds) |
static Duration | fromMillis (long milliseconds) |
static Duration | fromMinutes (long minutes) |
static Duration | fromMinutes (long minutes) |
static Duration | fromNanos (long nanoseconds) |
static Duration | fromNanos (long nanoseconds) |
static Duration | fromSeconds (long seconds) |
static Duration | fromSeconds (long seconds) |
static boolean | isNegative (Duration duration) |
static boolean | isNegative (Duration duration) |
static boolean | isPositive (Duration duration) |
static boolean | isValid (Duration duration) |
static boolean | isValid (Duration duration) |
static boolean | isValid (long seconds, int nanos) |
static boolean | isValid (long seconds, int nanos) |
static Duration | parse (String value) throws ParseException |
static Duration | parse (String value) throws ParseException |
static Duration | parseUnchecked (@CompileTimeConstant String value) |
static Duration | subtract (Duration d1, Duration d2) |
static Duration | subtract (Duration d1, Duration d2) |
static long | toDays (Duration duration) |
static long | toDays (Duration duration) |
static long | toHours (Duration duration) |
static long | toHours (Duration duration) |
static long | toMicros (Duration duration) |
static long | toMicros (Duration duration) |
static long | toMillis (Duration duration) |
static long | toMillis (Duration duration) |
static long | toMinutes (Duration duration) |
static long | toMinutes (Duration duration) |
static long | toNanos (Duration duration) |
static long | toNanos (Duration duration) |
static long | toSeconds (Duration duration) |
static long | toSeconds (Duration duration) |
static double | toSecondsAsDouble (Duration duration) |
static double | toSecondsAsDouble (Duration duration) |
static String | toString (Duration duration) |
static String | toString (Duration duration) |
Static Public Attributes | |
static final Duration | MAX_VALUE |
static final Duration | MIN_VALUE |
static final Duration | ZERO = Duration.newBuilder().setSeconds(0L).setNanos(0).build() |
Private Member Functions | |
Durations () | |
Durations () | |
Static Private Attributes | |
static final Comparator< Duration > | COMPARATOR |
static final long | SECONDS_PER_DAY = SECONDS_PER_HOUR * 24 |
static final long | SECONDS_PER_HOUR = SECONDS_PER_MINUTE * 60 |
static final long | SECONDS_PER_MINUTE = 60L |
Utilities to help create/manipulate
. All operations throw an IllegalArgumentException if the input(s) are not {@linkplain isValid(Duration) valid}.
Definition at line 54 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlineprivate |
Definition at line 73 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlineprivate |
Definition at line 75 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Add two durations.
Definition at line 423 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Add two durations.
Definition at line 447 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Ensures that the given Duration is not negative.
IllegalArgumentException | if duration
|
NullPointerException | if duration
null
|
Definition at line 156 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Ensures that the given Duration is not negative.
IllegalArgumentException | if duration
|
NullPointerException | if duration
null
|
Definition at line 166 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Ensures that the given Duration is positive.
IllegalArgumentException | if duration
|
NullPointerException | if duration
null
|
Definition at line 169 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Ensures that the given Duration is positive.
IllegalArgumentException | if duration
|
NullPointerException | if duration
null
|
Definition at line 178 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Throws an IllegalArgumentException if the given Duration is not valid.
Definition at line 180 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Throws an IllegalArgumentException if the given Duration is not valid.
Definition at line 185 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Builds the given builder and throws an IllegalArgumentException if it is not valid. See checkValid(Duration).
Definition at line 201 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Builds the given builder and throws an IllegalArgumentException if it is not valid. See checkValid(Duration).
Definition at line 206 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns a Comparator for Durations which sorts in increasing chronological order. Nulls and invalid Durations are not allowed (see isValid).
Definition at line 90 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns a Comparator for Durations which sorts in increasing chronological order. Nulls and invalid Durations are not allowed (see isValid). The returned comparator is serializable.
Definition at line 94 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Compares two durations. The value returned is identical to what would be returned by:
.
Definition at line 101 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Compares two durations. The value returned is identical to what would be returned by:
.
Definition at line 105 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of days.
Definition at line 278 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of days.
Definition at line 302 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of hours.
Definition at line 287 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of hours.
Definition at line 311 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of microseconds.
Definition at line 319 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of microseconds.
Definition at line 343 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of milliseconds.
Definition at line 311 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of milliseconds.
Definition at line 335 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of minutes.
Definition at line 296 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of minutes.
Definition at line 320 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of nanoseconds.
Definition at line 327 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of nanoseconds.
Definition at line 351 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of seconds.
Definition at line 305 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Create a Duration from the number of seconds.
Definition at line 329 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns whether the given Duration is negative or not.
Definition at line 144 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns whether the given Duration is negative or not.
Definition at line 148 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns whether the given Duration is positive or not.
Definition at line 154 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns true if the given Duration is valid. The
value must be in the range [-315,576,000,000, +315,576,000,000]. The
value must be in the range [-999,999,999, +999,999,999].
Note: Durations less than one second are represented with a 0
field and a positive or negative
field. For durations of one second or more, a non-zero value for the
field must be of the same sign as the
field.
Definition at line 114 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns true if the given Duration is valid. The
value must be in the range [-315,576,000,000, +315,576,000,000]. The
value must be in the range [-999,999,999, +999,999,999].
Note: Durations less than one second are represented with a 0
field and a positive or negative
field. For durations of one second or more, a non-zero value for the
field must be of the same sign as the
field.
Definition at line 118 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Returns true if the given number of seconds and nanos is a valid Duration. The
value must be in the range [-315,576,000,000, +315,576,000,000]. The
value must be in the range [-999,999,999, +999,999,999].
Note: Durations less than one second are represented with a 0
field and a positive or negative
field. For durations of one second or more, a non-zero value for the
field must be of the same sign as the
field.
Definition at line 128 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Returns true if the given number of seconds and nanos is a valid Duration. The
value must be in the range [-315,576,000,000, +315,576,000,000]. The
value must be in the range [-999,999,999, +999,999,999].
Note: Durations less than one second are represented with a 0
field and a positive or negative
field. For durations of one second or more, a non-zero value for the
field must be of the same sign as the
field.
Definition at line 132 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Parse from a string to produce a duration.
ParseException | if parsing fails. |
Definition at line 241 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Parse from a string to produce a duration.
ParseException | if parsing fails. |
Definition at line 246 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Parses a string in RFC 3339 format into a Duration.
Identical to parse(String), but throws an IllegalArgumentException instead of a ParseException if parsing fails.
IllegalArgumentException | if parsing fails |
Definition at line 288 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Subtract a duration from another.
Definition at line 431 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Subtract a duration from another.
Definition at line 455 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of days. The result will be rounded towards 0 to the nearest day.
Definition at line 339 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of days. The result will be rounded towards 0 to the nearest day.
Definition at line 363 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of hours. The result will be rounded towards 0 to the nearest hour.
Definition at line 348 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of hours. The result will be rounded towards 0 to the nearest hour.
Definition at line 372 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of microseconds. The result will be rounded towards 0 to the nearest microseconds. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
Definition at line 405 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of microseconds. The result will be rounded towards 0 to the nearest microseconds. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
Definition at line 429 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of milliseconds. The result will be rounded towards 0 to the nearest millisecond. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
Definition at line 393 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of milliseconds. The result will be rounded towards 0 to the nearest millisecond. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
Definition at line 417 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of minutes. The result will be rounded towards 0 to the nearest minute.
Definition at line 357 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of minutes. The result will be rounded towards 0 to the nearest minute.
Definition at line 381 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of nanoseconds.
Definition at line 414 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of nanoseconds.
Definition at line 438 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of seconds. The result will be rounded towards 0 to the nearest second. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
Definition at line 366 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
Convert a Duration to the number of seconds. The result will be rounded towards 0 to the nearest second. E.g., if the duration represents -1 nanosecond, it will be rounded to 0.
Definition at line 390 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns the number of seconds of the given duration as a
. This method should be used to accommodate APIs that only accept durations as
values.
This conversion may lose precision.
If you need the number of seconds in this duration as a
(not a
), simply use
or toSeconds (which includes validation).
Definition at line 383 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Returns the number of seconds of the given duration as a
. This method should be used to accommodate APIs that only accept durations as
values.
This conversion may lose precision.
If you need the number of seconds in this duration as a
(not a
), simply use
or toSeconds (which includes validation).
Definition at line 407 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Convert Duration to string format. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent the exact Duration value. For example: "1s", "1.010s", "1.000000100s", "-3.100s" The range that can be represented by Duration is from -315,576,000,000 to +315,576,000,000 inclusive (in seconds).
IllegalArgumentException | if the given duration is not in the valid range. |
Definition at line 214 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
inlinestatic |
Convert Duration to string format. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent the exact Duration value. For example: "1s", "1.010s", "1.000000100s", "-3.100s" The range that can be represented by Duration is from -315,576,000,000 to +315,576,000,000 inclusive (in seconds).
IllegalArgumentException | if the given duration is not in the valid range. |
Definition at line 219 of file protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
staticprivate |
Definition at line 75 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
static |
A constant holding the maximum valid Duration, approximately
years.
Definition at line 67 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
static |
A constant holding the minimum valid Duration, approximately
years.
Definition at line 63 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
staticprivate |
Definition at line 60 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
staticprivate |
Definition at line 59 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
staticprivate |
Definition at line 58 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.
|
static |
A constant holding the duration of zero.
Definition at line 71 of file bloaty/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java.