public class SizeWithUnit extends Object implements Serializable
Constructor and Description |
---|
SizeWithUnit(float size,
Sizeable.Unit unit)
Constructs a new SizeWithUnit object representing the pair (size, unit).
|
Modifier and Type | Method and Description |
---|---|
float |
getSize()
Returns the numeric value stored in this object.
|
Sizeable.Unit |
getUnit()
Returns the unit stored in this object.
|
static SizeWithUnit |
parseStringSize(String s)
Returns an object whose numeric value and unit are taken from the string
s.
|
static SizeWithUnit |
parseStringSize(String s,
Sizeable.Unit defaultUnit)
Returns an object whose numeric value and unit are taken from the string
s.
|
public SizeWithUnit(float size, Sizeable.Unit unit)
size
- a numeric valueunit
- a unitpublic float getSize()
public Sizeable.Unit getUnit()
public static SizeWithUnit parseStringSize(String s, Sizeable.Unit defaultUnit)
s
- the string to be parseddefaultUnit
- The unit to be used if s does not contain any unit. Use null
for no default unit.public static SizeWithUnit parseStringSize(String s)
s
- the string to be parsedCopyright © 2022 Vaadin Ltd. All rights reserved.