public class Length extends Object implements OdfDataType
Modifier and Type | Class and Description |
---|---|
static class |
Length.Unit
Measurement units for ODF datatype length
|
Constructor and Description |
---|
Length(String length)
Construct Length by the parsing the given string
|
Modifier and Type | Method and Description |
---|---|
static boolean |
isValid(String stringValue)
Check if the specified String instance is a valid length data type
|
String |
mapToUnit(Length.Unit destinationUnit) |
static String |
mapToUnit(String length,
Length.Unit destinationUnit)
Maps the a length string to a different unit
|
static double |
parseDouble(String length)
Returns the value of the given length as double.
|
static double |
parseDouble(String length,
Length.Unit destinationUnit)
Maps the a length string to a different unit
|
static int |
parseInt(String length)
Returns the value of the given length as int.
|
static int |
parseInt(String length,
Length.Unit destinationUnit)
Returns the value of the given length as int.
|
static long |
parseLong(String length)
Returns the value of the given length as long.
|
static long |
parseLong(String length,
Length.Unit destinationUnit)
Maps the a length string to a different unit
|
static Length.Unit |
parseUnit(String length)
Returns the Unit of the given length.
|
String |
toString()
Returns a String Object representing this Length's value
|
static Length |
valueOf(String stringValue)
Returns a Length instance representing the specified String value
|
public Length(String length) throws NumberFormatException
length
- The String to be parsed into LengthNumberFormatException
- if the given argument is not a valid Lengthpublic static boolean isValid(String stringValue)
stringValue
- the value to be testedpublic static Length.Unit parseUnit(String length)
length
- the Unit
should be obtained fromUnit
object representing the specified Length unit.public static int parseInt(String length)
length
- the int
value should be obtained fromint
value representing the specified Length value.public static int parseInt(String length, Length.Unit destinationUnit)
length
- the int
value should be obtained fromdestinationUnit
- The unit to be converted toint
value representing the specified Length value.public static long parseLong(String length)
length
- the long
value should be obtained fromlong
value representing the specified Length value.public static long parseLong(String length, Length.Unit destinationUnit)
length
- The value to be mappeddestinationUnit
- The unit to be converted topublic static double parseDouble(String length)
length
- the double
value should be obtained fromdouble
value representing the specified Length value.public static double parseDouble(String length, Length.Unit destinationUnit)
length
- The value to be mappeddestinationUnit
- The unit to be converted topublic String mapToUnit(Length.Unit destinationUnit)
destinationUnit
- The unit to be converted topublic static String mapToUnit(String length, Length.Unit destinationUnit)
length
- The value to be mappeddestinationUnit
- The unit to be converted topublic static Length valueOf(String stringValue) throws NumberFormatException
stringValue
- a String valueNumberFormatException
- if the given argument is not a valid LengthCopyright © 2008-2013 The Apache Software Foundation. All Rights Reserved.