Package org.apache.sis.measure
Enum UnitFormat.Style
- Object
-
- Enum<UnitFormat.Style>
-
- Style
-
- All Implemented Interfaces:
Serializable
,Comparable<UnitFormat.Style>
- Enclosing class:
- UnitFormat
public static enum UnitFormat.Style extends Enum<UnitFormat.Style>
Identify whether unit formatting uses ASCII symbols, Unicode symbols or full localized names. For example theUnits.CUBIC_METRE
units can be formatted in the following ways:- As a symbol using Unicode characters: m³
- As a symbol restricted to the ASCII characters set: m3
- As a long name:
- in English: cubic metre
- in French: mètre cube
- Since:
- 0.8
Defined in the
sis-utility
module
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NAME
Format unit symbols as localized long names if known, or Unicode symbols otherwise.SYMBOL
Format unit symbols using Unicode characters.UCUM
Format unit symbols using a syntax close to the Unified Code for Units of Measure (UCUM) one.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static UnitFormat.Style
valueOf(String name)
Returns the enum constant of this type with the specified name.static UnitFormat.Style[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SYMBOL
public static final UnitFormat.Style SYMBOL
Format unit symbols using Unicode characters. Units formatted in this style use superscript digits for exponents (as in “m³”), the dot operator (“⋅”) for multiplications, specialized characters when they exist (e.g. U+212A “K” for Kelvin sign), etc.This is the default style of
UnitFormat
.- See Also:
Unit.getSymbol()
-
UCUM
public static final UnitFormat.Style UCUM
Format unit symbols using a syntax close to the Unified Code for Units of Measure (UCUM) one. The character set is restricted to ASCII. The multiplication operator is the period (“.”).Modification to UCUM syntax rulesUCUM does not allow floating point numbers in unit terms, so the use of period as an operator should not be ambiguous. However Apache SIS relaxes this restriction in order to support the scale factors commonly found in angular units (e.g. π/180). The meaning of a period in a string is resolved with two SIS-specific rules:- Unit symbols shall not begin or end with a decimal digit or a superscript.
- A period between two decimal digits is interpreted as a decimal separator.
- See Also:
CharSequences.toASCII(CharSequence)
-
NAME
public static final UnitFormat.Style NAME
Format unit symbols as localized long names if known, or Unicode symbols otherwise.- See Also:
Unit.getName()
-
-
Method Detail
-
values
public static UnitFormat.Style[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (UnitFormat.Style c : UnitFormat.Style.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static UnitFormat.Style valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-