This allows a TemporalAmount, such as Duration or Period,
to be formatted. Only selected formatting options are provided.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static interface | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | BUNDLE_NAME
The resource bundle name. |
| private static final int | DAYS_PER_WEEK
The number of days per week. |
| private static final List | DURATION_UNITS
List of DurationUnit values ordered by longest suffix first. |
| private static final AmountFormats. | EMPTY_FRACTION
Zero value for an absent fractional component of a numeric duration string. |
| private static final int | HOURS_PER_DAY
The number of hours per day. |
| private static final int | MINUTES_PER_HOUR
The number of minutes per hour. |
| private static final int | NANOS_PER_MILLIS
The number of nanosecond per millisecond. |
| private static final IntPredicate | PREDICATE_1
The predicate that matches 1 or -1. |
| private static final IntPredicate | PREDICATE_END1_NOT11
The predicate that matches numbers ending 1 but not ending 11. |
| private static final IntPredicate | PREDICATE_END234_NOTTEENS
The predicate that matches numbers ending 2, 3 or 4, but not ending 12, 13 or 14. |
| private static final int | SECONDS_PER_MINUTE
The number of seconds per minute. |
| private static final Pattern | SPLITTER
The pattern to split lists with. |
| private static final String | WORDBASED_COMMASPACE
The property file key for the separator ", ". |
| private static final String | WORDBASED_DAY
The property file key for the word "day". |
| private static final String | WORDBASED_HOUR
The property file key for the word "hour". |
| private static final String | WORDBASED_MILLISECOND
The property file key for the word "millisecond". |
| private static final String | WORDBASED_MINUTE
The property file key for the word "minute". |
| private static final String | WORDBASED_MONTH
The property file key for the word "month". |
| private static final String | WORDBASED_SECOND
The property file key for the word "second". |
| private static final String | WORDBASED_SPACEANDSPACE
The property file key for the separator " and ". |
| private static final String | WORDBASED_WEEK
The property file key for the word "week". |
| private static final String | WORDBASED_YEAR
The property file key for the word "year". |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static AmountFormats. | |
| private static AmountFormats. | |
| private static Optional | |
| private static Optional | |
| public static String | |
| private static boolean | |
| public static Duration | Returns: theDuration value represented by the string, if possible.the formatted unit-based duration string. durationText)Parses formatted durations based on units. |
| public static String | |
| public static String | |
| public static String |
| BUNDLE_NAME | back to summary |
|---|---|
| private static final String BUNDLE_NAME The resource bundle name. | |
| DAYS_PER_WEEK | back to summary |
|---|---|
| private static final int DAYS_PER_WEEK The number of days per week. | |
| DURATION_UNITS | back to summary |
|---|---|
| private static final List<AmountFormats. List of DurationUnit values ordered by longest suffix first. | |
| EMPTY_FRACTION | back to summary |
|---|---|
| private static final AmountFormats. Zero value for an absent fractional component of a numeric duration string. | |
| HOURS_PER_DAY | back to summary |
|---|---|
| private static final int HOURS_PER_DAY The number of hours per day. | |
| MINUTES_PER_HOUR | back to summary |
|---|---|
| private static final int MINUTES_PER_HOUR The number of minutes per hour. | |
| NANOS_PER_MILLIS | back to summary |
|---|---|
| private static final int NANOS_PER_MILLIS The number of nanosecond per millisecond. | |
| PREDICATE_1 | back to summary |
|---|---|
| private static final IntPredicate PREDICATE_1 The predicate that matches 1 or -1. | |
| PREDICATE_END1_NOT11 | back to summary |
|---|---|
| private static final IntPredicate PREDICATE_END1_NOT11 The predicate that matches numbers ending 1 but not ending 11. | |
| PREDICATE_END234_NOTTEENS | back to summary |
|---|---|
| private static final IntPredicate PREDICATE_END234_NOTTEENS The predicate that matches numbers ending 2, 3 or 4, but not ending 12, 13 or 14. | |
| SECONDS_PER_MINUTE | back to summary |
|---|---|
| private static final int SECONDS_PER_MINUTE The number of seconds per minute. | |
| SPLITTER | back to summary |
|---|---|
| private static final Pattern SPLITTER The pattern to split lists with. | |
| WORDBASED_COMMASPACE | back to summary |
|---|---|
| private static final String WORDBASED_COMMASPACE The property file key for the separator ", ". | |
| WORDBASED_DAY | back to summary |
|---|---|
| private static final String WORDBASED_DAY The property file key for the word "day". | |
| WORDBASED_HOUR | back to summary |
|---|---|
| private static final String WORDBASED_HOUR The property file key for the word "hour". | |
| WORDBASED_MILLISECOND | back to summary |
|---|---|
| private static final String WORDBASED_MILLISECOND The property file key for the word "millisecond". | |
| WORDBASED_MINUTE | back to summary |
|---|---|
| private static final String WORDBASED_MINUTE The property file key for the word "minute". | |
| WORDBASED_MONTH | back to summary |
|---|---|
| private static final String WORDBASED_MONTH The property file key for the word "month". | |
| WORDBASED_SECOND | back to summary |
|---|---|
| private static final String WORDBASED_SECOND The property file key for the word "second". | |
| WORDBASED_SPACEANDSPACE | back to summary |
|---|---|
| private static final String WORDBASED_SPACEANDSPACE The property file key for the separator " and ". | |
| WORDBASED_WEEK | back to summary |
|---|---|
| private static final String WORDBASED_WEEK The property file key for the word "week". | |
| WORDBASED_YEAR | back to summary |
|---|---|
| private static final String WORDBASED_YEAR The property file key for the word "year". | |
| AmountFormats | back to summary |
|---|---|
| private AmountFormats() | |
| consumeDurationFraction | back to summary |
|---|---|
| private static AmountFormats. | |
| consumeDurationLeadingInt | back to summary |
|---|---|
| private static AmountFormats. | |
| consumePrefix | back to summary |
|---|---|
| private static Optional | |
| findUnit | back to summary |
|---|---|
| private static Optional | |
| iso8601 | back to summary |
|---|---|
| public static String iso8601(Period period, Duration duration) Formats a period and duration to a string in ISO-8601 format.
To obtain the ISO-8601 format of a | |
| oppositeSigns | back to summary |
|---|---|
| private static boolean oppositeSigns(int a, int b) | |
| parseUnitBasedDuration | back to summary |
|---|---|
| public static Duration parseUnitBasedDuration(CharSequence durationText) Parses formatted durations based on units. The behaviour matches the Golang duration parser, however, infinite durations are not supported. The duration format is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
Note, the value "0" is specially supported as
| |
| wordBased | back to summary |
|---|---|
| public static String wordBased(Period period, Locale locale) Formats a period to a string in a localized word-based format.
This returns a word-based format for the period.
The year and month are printed as supplied unless the signs differ, in which case they are normalized.
The words are configured in a resource bundle text file -
| |
| wordBased | back to summary |
|---|---|
| public static String wordBased(Duration duration, Locale locale) Formats a duration to a string in a localized word-based format.
This returns a word-based format for the duration.
The words are configured in a resource bundle text file -
| |
| wordBased | back to summary |
|---|---|
| public static String wordBased(Period period, Duration duration, Locale locale) Formats a period and duration to a string in a localized word-based format.
This returns a word-based format for the period.
The year and month are printed as supplied unless the signs differ, in which case they are normalized.
The words are configured in a resource bundle text file -
| |
| Modifier and Type | Method and Description |
|---|---|
| public Duration |
| applyTo | back to summary |
|---|---|
| public Duration applyTo(AmountFormats. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv CharSequence | |
| pack-priv boolean | |
| pack-priv Duration |
| abbrev | back to summary |
|---|---|
| private final String abbrev | |
| value | back to summary |
|---|---|
| private final Duration value | |
| DurationUnit | back to summary |
|---|---|
| private DurationUnit(String abbrev, Duration value) | |
| consumeDurationUnit | back to summary |
|---|---|
| pack-priv CharSequence consumeDurationUnit(CharSequence text) | |
| prefixMatchesUnit | back to summary |
|---|---|
| pack-priv boolean prefixMatchesUnit(CharSequence text) | |
| scaleBy | back to summary |
|---|---|
| pack-priv Duration scaleBy(Function<Duration, Duration> scaleFunc) | |
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Duration |
| scale | back to summary |
|---|---|
| private final long scale | |
| value | back to summary |
|---|---|
| private final long value | |
| FractionScalarPart | back to summary |
|---|---|
| private FractionScalarPart(long value, long scale) | |
| applyTo | back to summary |
|---|---|
| public Duration applyTo(AmountFormats. Implements org.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Duration |
| value | back to summary |
|---|---|
| private final long value | |
| IntegerScalarPart | back to summary |
|---|---|
| private IntegerScalarPart(long value) | |
| applyTo | back to summary |
|---|---|
| public Duration applyTo(AmountFormats. Implements org.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final CharSequence | |
| private final AmountFormats. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Duration | |
| pack-priv CharSequence |
| remainingText | back to summary |
|---|---|
| private final CharSequence remainingText | |
| scalar | back to summary |
|---|---|
| private final AmountFormats. | |
| ParsedUnitPart | back to summary |
|---|---|
| private ParsedUnitPart(CharSequence remainingText, AmountFormats. | |
| applyTo | back to summary |
|---|---|
| public Duration applyTo(AmountFormats. Implements org.
| |
| remainingText | back to summary |
|---|---|
| pack-priv CharSequence remainingText() | |
| Modifier and Type | Field and Description |
|---|---|
| private final IntPredicate[] | |
| private final String[] |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private IntPredicate | |
| public void | formatTo(int value, StringBuilder buf)
Implements org.
|
| predicates | back to summary |
|---|---|
| private final IntPredicate[] predicates | |
| text | back to summary |
|---|---|
| private final String[] text | |
| PredicateFormat | back to summary |
|---|---|
| pack-priv PredicateFormat(String[] predicateStrs, String[] text) | |
| findPredicate | back to summary |
|---|---|
| private IntPredicate findPredicate(String predicateStr) | |
| formatTo | back to summary |
|---|---|
| public void formatTo(int value, StringBuilder buf) Implements org.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | formatTo(int value, StringBuilder buf)
Implements org.
|
| plural | back to summary |
|---|---|
| private final String plural | |
| single | back to summary |
|---|---|
| private final String single | |
| SinglePluralFormat | back to summary |
|---|---|
| pack-priv SinglePluralFormat(String single, String plural) | |
| formatTo | back to summary |
|---|---|
| public void formatTo(int value, StringBuilder buf) Implements org.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public static AmountFormats. |
| formatTo | back to summary |
|---|---|
| public void formatTo(int value, StringBuilder buf) | |
| of | back to summary |
|---|---|
| public static AmountFormats. | |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final String | |
| private final AmountFormats. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String |
| lastSeparator | back to summary |
|---|---|
| private final String lastSeparator | |
| separator | back to summary |
|---|---|
| private final String separator | |
| units | back to summary |
|---|---|
| private final AmountFormats. | |
| WordBased | back to summary |
|---|---|
| public WordBased(AmountFormats. | |
| format | back to summary |
|---|---|
| pack-priv String format(int[] values) | |