Class ExtensionValue

java.lang.Object
org.incenp.obofoundry.sssom.model.ExtensionValue

public class ExtensionValue extends Object
Represents the value of an extension slot.
  • Constructor Details

    • 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 - If true, 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 Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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:
      true if the value is typed as an integer.
    • isDouble

      public boolean isDouble()
      Returns:
      true if the value is typed as a double.
    • isBoolean

      public boolean isBoolean()
      Returns:
      true if the value is typed as a boolean.
    • isDate

      public boolean isDate()
      Returns:
      true if the value is typed as a date.
    • isDatetime

      public boolean isDatetime()
      Returns:
      true if the value is typed as a date and time object.
    • isIdentifier

      public boolean isIdentifier()
      Returns:
      true if the value is typed as an identifier.
    • isString

      public boolean isString()
      Returns:
      true if the value is typed as a string.
    • asInteger

      public Integer asInteger()
      Returns:
      The value as an integer, or null if the value has another type.
    • asDouble

      public Double asDouble()
      Returns:
      The value as a double, or null if the value has another type.
    • asBoolean

      public Boolean asBoolean()
      Returns:
      The value as a boolean, or null if the value has another type.
    • asDate

      public LocalDate asDate()
      Returns:
      The value as a date, or null if the value has another type.
    • asDatetime

      public ZonedDateTime asDatetime()
      Returns:
      The value as a date and time object, or null if the value has another type.
    • asString

      public String asString()
      Returns:
      The value as a string, or null if the value is not typed as a string or an identifier.
    • asURI

      public URI asURI()
      Returns:
      The value as a URI, or null if the value is not typed as such.