Class ExtensionValue
- java.lang.Object
-
- org.incenp.obofoundry.sssom.model.ExtensionValue
-
public class ExtensionValue extends Object
Represents the value of an extension slot.
-
-
Constructor Summary
Constructors Constructor Description ExtensionValue(boolean b)Creates a new boolean-typed value.ExtensionValue(double d)Creates a new double-typed value.ExtensionValue(int i)Creates a new integer-typed value.ExtensionValue(Object o)Creates a new value with an unknown type.ExtensionValue(String s)Creates a new string-typed value.ExtensionValue(String s, boolean isIdentifier)Creates a new string-based value that may be an identifier.ExtensionValue(URI uri)Creates a new value representing a URI.ExtensionValue(LocalDate date)Creates a new value representing a date.ExtensionValue(ZonedDateTime time)Creates a new value representing a date and time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanasBoolean()LocalDateasDate()ZonedDateTimeasDatetime()DoubleasDouble()IntegerasInteger()StringasString()URIasURI()ValueTypegetType()ObjectgetValue()booleanisBoolean()booleanisDate()booleanisDatetime()booleanisDouble()booleanisIdentifier()booleanisInteger()booleanisString()StringtoString()
-
-
-
Constructor Detail
-
ExtensionValue
public ExtensionValue(int i)
Creates a new integer-typed value.- Parameters:
i- The value.
-
ExtensionValue
public ExtensionValue(double d)
Creates a new double-typed value.- Parameters:
d- The value.
-
ExtensionValue
public ExtensionValue(boolean b)
Creates a new boolean-typed value.- Parameters:
b- The value.
-
ExtensionValue
public ExtensionValue(LocalDate date)
Creates a new value representing a date.- Parameters:
date- The value.
-
ExtensionValue
public ExtensionValue(ZonedDateTime time)
Creates a new value representing a date and time.- Parameters:
time- The value.
-
ExtensionValue
public ExtensionValue(String s)
Creates a new string-typed value.- Parameters:
s- The value.
-
ExtensionValue
public ExtensionValue(String s, boolean isIdentifier)
Creates a new string-based value that may be an identifier.- Parameters:
s- The value.isIdentifier- Iftrue, the value is treated as an identifier; otherwise it is treated as a normal string.
-
ExtensionValue
public ExtensionValue(URI uri)
Creates a new value representing a URI.- Parameters:
uri- The value.
-
ExtensionValue
public ExtensionValue(Object o)
Creates a new value with an unknown type.- Parameters:
o- The value.
-
-
Method Detail
-
getType
public ValueType getType()
- Returns:
- The type of the value.
-
getValue
public Object getValue()
- Returns:
- The actual value, as an object of unknown type.
-
isInteger
public boolean isInteger()
- Returns:
trueif the value is typed as an integer.
-
isDouble
public boolean isDouble()
- Returns:
trueif the value is typed as a double.
-
isBoolean
public boolean isBoolean()
- Returns:
trueif the value is typed as a boolean.
-
isDate
public boolean isDate()
- Returns:
trueif the value is typed as a date.
-
isDatetime
public boolean isDatetime()
- Returns:
trueif the value is typed as a date and time object.
-
isIdentifier
public boolean isIdentifier()
- Returns:
trueif the value is typed as an identifier.
-
isString
public boolean isString()
- Returns:
trueif the value is typed as a string.
-
asInteger
public Integer asInteger()
- Returns:
- The value as an integer, or
nullif the value has another type.
-
asDouble
public Double asDouble()
- Returns:
- The value as a double, or
nullif the value has another type.
-
asBoolean
public Boolean asBoolean()
- Returns:
- The value as a boolean, or
nullif the value has another type.
-
asDate
public LocalDate asDate()
- Returns:
- The value as a date, or
nullif the value has another type.
-
asDatetime
public ZonedDateTime asDatetime()
- Returns:
- The value as a date and time object, or
nullif the value has another type.
-
asString
public String asString()
- Returns:
- The value as a string, or
nullif the value is not typed as a string or an identifier.
-
asURI
public URI asURI()
- Returns:
- The value as a URI, or
nullif the value is not typed as such.
-
-