public enum DistanceFormatter extends Enum<DistanceFormatter> implements Converter<String,Distance>, Formatter<Distance>
Distance
instances from String
representations. The supported format is a decimal
followed by whitespace and a metric abbreviation. We currently support the following abbreviations:
SUPPORTED_METRICS
.Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and Description |
---|---|
Distance |
convert(String source) |
Distance |
parse(String text,
Locale locale) |
String |
print(Distance distance,
Locale locale) |
static DistanceFormatter |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DistanceFormatter[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DistanceFormatter INSTANCE
public static DistanceFormatter[] values()
for (DistanceFormatter c : DistanceFormatter.values()) System.out.println(c);
public static DistanceFormatter valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic Distance parse(String text, Locale locale) throws ParseException
parse
in interface Parser<Distance>
ParseException
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.