class TimestampKind extends KindOfQuantity<TimestampUnit>
| Modifier and Type | Class and Description |
|---|---|
private static class |
TimestampKind.FractionFormatter |
private static class |
TimestampKind.LegacyAndFractionFormatter |
private static class |
TimestampKind.LegacyFormatter |
KindOfQuantity.ExactFormatter<U extends TypedUnit<U>>, KindOfQuantity.VerboseFormatter<U extends TypedUnit<U>>m_identifier| Modifier | Constructor and Description |
|---|---|
private |
TimestampKind() |
| Modifier and Type | Method and Description |
|---|---|
static TimestampKind |
buildContentType(LinearKindOfQuantity timespan) |
(package private) static java.text.DateFormat |
getDateTimeFormatter()
Only for formatting, not parsing!
|
TimestampUnit |
getDefaultUnit() |
KindOfQuantity<LinearUnit> |
getDeltaKind() |
IFormatter<IQuantity> |
getFormatterResolving(IRange<IQuantity> range)
Get a formatter with sufficient resolution to produce unique strings for both ends of
range, and consecutive equally spaced quantities. |
TimestampUnit |
getLargestExactUnit(IQuantity value)
Get the largest unit, if any, in which this quantity can be expressed exactly, typically with
an integer.
|
TimestampUnit |
getPreferredUnit(IQuantity value,
double minNumericalValue,
double maxNumericalValue) |
ITypedQuantity<TimestampUnit> |
parseInteractive(java.lang.String interactiveQuantity)
Parse an interactive string.
|
ITypedQuantity<TimestampUnit> |
parsePersisted(java.lang.String persistedQuantity)
Parse a persisted string.
|
private static java.text.DateFormat |
patchYear(java.text.DateFormat df) |
addUnit, combine, format, getAccessor, getAccessorKeys, getAllUnits, getAttributes, getCommonUnits, getFirstBucket, getFirstBucket, getPersister, getRangeFormatter, getUnit, interactiveFormat, persistableString, resolveLocalizedName, resolveLocalizedSymbol, validateaddFormatter, getDefaultFormatter, getDescription, getFormatter, getFormatters, getIdentifier, getName, hasAttribute, lookupNameFor, toStringprivate static final java.util.regex.Pattern NUMBER_UNIT_PATTERN
private static final FormatThreadLocal<java.text.DateFormat> DATE_TIME_FORMATTER_HOLDER
static TimestampUnit NANOS_UNIT
static TimestampUnit MICROS_UNIT
static TimestampUnit MILLIS_UNIT
static TimestampUnit SECONDS_UNIT
static TimestampKind INSTANCE
private static IFormatter<IQuantity> YEAR_TO_DAY_FORMATTER
private static IFormatter<IQuantity> YEAR_TO_SECONDS_FORMATTER
private static IFormatter<IQuantity> YEAR_TO_MILLIS_FORMATTER
private static IFormatter<IQuantity> YEAR_TO_MICROS_FORMATTER
private static IFormatter<IQuantity> YEAR_TO_NANOS_FORMATTER
private static IFormatter<IQuantity> HOUR_TO_SECONDS_FORMATTER
private static IFormatter<IQuantity> HOUR_TO_MILLIS_FORMATTER
private static IFormatter<IQuantity> HOUR_TO_MICROS_FORMATTER
private static IFormatter<IQuantity> HOUR_TO_NANOS_FORMATTER
private static IFormatter<IQuantity> MILLIS_FORMATTER
private static IFormatter<IQuantity> MICROS_FORMATTER
private static IFormatter<IQuantity> NANOS_FORMATTER
private static java.text.DateFormat patchYear(java.text.DateFormat df)
static java.text.DateFormat getDateTimeFormatter()
public static TimestampKind buildContentType(LinearKindOfQuantity timespan)
public TimestampUnit getPreferredUnit(IQuantity value, double minNumericalValue, double maxNumericalValue)
getPreferredUnit in class KindOfQuantity<TimestampUnit>public TimestampUnit getLargestExactUnit(IQuantity value)
KindOfQuantityquantity.doubleValue() == 0.0),
quantity.getUnit() will be returned. Thus, if you want to find
out a maximum common unit for a set of quantities (not recommended), only use the non-zero
quantities.
Note that this may be a fairly expensive operation, and isn't intended to be used excessively. The only valid use case is for guessing the original unit in which a quantity was expressed, after it has been stored or transmitted using a legacy mechanism with a fixed unit.
getLargestExactUnit in class KindOfQuantity<TimestampUnit>nullpublic IFormatter<IQuantity> getFormatterResolving(IRange<IQuantity> range)
KindOfQuantityrange, and consecutive equally spaced quantities. The returned formatter might
implement IIncrementalFormatter, in which case its method can be used to reduce
redundant information between adjacent quantities.getFormatterResolving in class KindOfQuantity<TimestampUnit>public KindOfQuantity<LinearUnit> getDeltaKind()
getDeltaKind in class KindOfQuantity<TimestampUnit>public TimestampUnit getDefaultUnit()
getDefaultUnit in class KindOfQuantity<TimestampUnit>public ITypedQuantity<TimestampUnit> parsePersisted(java.lang.String persistedQuantity) throws QuantityConversionException
KindOfQuantityIQuantity.persistableString() for quantities of this kind of quantity. Only use this
on persisted strings, never for interactive input.parsePersisted in interface IConstraint<IQuantity>parsePersisted in class KindOfQuantity<TimestampUnit>persistedQuantity - persisted string to parseQuantityConversionException - if parsing failedpublic ITypedQuantity<TimestampUnit> parseInteractive(java.lang.String interactiveQuantity) throws QuantityConversionException
KindOfQuantityIQuantity.interactiveFormat() for quantities of this kind of quantity and in the same
locale. Only use this for interactive input, never for persisted strings.parseInteractive in interface IConstraint<IQuantity>parseInteractive in class KindOfQuantity<TimestampUnit>interactiveQuantity - interactive string to parseQuantityConversionException - if parsing failed