Package oracle.nosql.driver.values

# Class LongValue

java.lang.Object
oracle.nosql.driver.values.FieldValue
oracle.nosql.driver.values.LongValue

All Implemented Interfaces:
  `Comparable<FieldValue>`

public class LongValue extends FieldValue
A `FieldValue` instance representing a long value.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class oracle.nosql.driver.values.FieldValue

  `FieldValue.Type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LongValue(long value)`
  Creates a new instance.
  `LongValue(String value)`
  Creates a new instance from a String value

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `castAsDouble()`
  Casts this long to a double, possibly with loss of information about magnitude, precision or sign.
  `int`
  `compareTo(FieldValue other)`
  `boolean`
  `equals(Object other)`
  `double`
  `getDouble()`
  Returns a Double value for this object.
  `int`
  `getInt()`
  Returns an integer value for the field if the value can be represented as a valid integer without loss of information.
  `BigDecimal`
  `getNumber()`
  Returns a BigDecimal value for this object.
  `String`
  `getString()`
  Returns a String value for the field.
  `Timestamp`
  `getTimestamp()`
  Returns a Timestamp value for this object based on the Timestamp value of the long value
  `FieldValue.Type`
  `getType()`
  Returns the type of the object
  `long`
  `getValue()`
  Returns the long value of this object
  `int`
  `hashCode()`
  `String`
  `toJson(JsonOptions options)`
  Returns a JSON representation of the value using the options, if specified.

  ### Methods inherited from class oracle.nosql.driver.values.FieldValue

  `asArray, asBinary, asBoolean, asDouble, asInteger, asJsonNull, asLong, asMap, asNull, asNumber, asString, asTimestamp, createFromJson, createFromJson, createFromJson, getBinary, getBoolean, getLong, getSerializedSize, isAnyNull, isArray, isAtomic, isBinary, isBoolean, isDouble, isInteger, isJsonNull, isLong, isMap, isNull, isNumber, isNumeric, isString, isTimestamp, toJson, toString`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### LongValue

    public LongValue(long value)
    Creates a new instance.
    Parameters:
      `value` - the value to use

  - ### LongValue

    public LongValue(String value)
    Creates a new instance from a String value
    Parameters:
      `value` - the value to use
    Throws:
      `NumberFormatException` - if the value is not a valid long

- ## Method Details

  - ### getType

    public FieldValue.Type getType()
    Description copied from class: `FieldValue`
    Returns the type of the object
    Specified by:
      `getType` in class `FieldValue`
    Returns:
      the type

  - ### getValue

    public long getValue()
    Returns the long value of this object
    Returns:
      the long value

  - ### castAsDouble

    public double castAsDouble()
    Casts this long to a double, possibly with loss of information about magnitude, precision or sign.
    Overrides:
      `castAsDouble` in class `FieldValue`
    Returns:
      a double value

  - ### compareTo

    public int compareTo(FieldValue other)

  - ### getDouble

    public double getDouble()
    Returns a Double value for this object.
    Overrides:
      `getDouble` in class `FieldValue`
    Returns:
      the double value

  - ### getNumber

    public BigDecimal getNumber()
    Returns a BigDecimal value for this object.
    Overrides:
      `getNumber` in class `FieldValue`
    Returns:
      the BigDecimal value

  - ### getInt

    public int getInt()
    Description copied from class: `FieldValue`
    Returns an integer value for the field if the value can be represented as a valid integer without loss of information. Numbers are coerced using Java rules and strings are parsed according to Java rules.
    Overrides:
      `getInt` in class `FieldValue`
    Returns:
      an integer value

  - ### getString

    public String getString()
    Description copied from class: `FieldValue`
    Returns a String value for the field. The String value cannot be created for MapValue, ArrayValue and BinaryValue. String values that are coerced use Java rules for representation.
    Overrides:
      `getString` in class `FieldValue`
    Returns:
      a String value

  - ### getTimestamp

    public Timestamp getTimestamp()
    Returns a Timestamp value for this object based on the Timestamp value of the long value
    Overrides:
      `getTimestamp` in class `FieldValue`
    Returns:
      the Timestamp value

  - ### toJson

    public String toJson(JsonOptions options)
    Description copied from class: `FieldValue`
    Returns a JSON representation of the value using the options, if specified.
    Overrides:
      `toJson` in class `FieldValue`
    Parameters:
      `options` - configurable options used to affect the JSON output format of some data types. May be null.
    Returns:
      the JSON representation of this value.

  - ### equals

    public boolean equals(Object other)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`