org.apache.tinkerpop.gremlin.driver

## Class Result

- java.lang.Object
- - org.apache.tinkerpop.gremlin.driver.Result

-     public final class Result
      extends Object

  A `Result` represents a result value from the server-side `Iterator` of results. This would be one item from that result set. This class provides methods for coercing the result `Object` to an expected type.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Result(Object responseData)` Constructs a "result" from data found in `ResponseResult.getData()`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `get(Class<? extends T> clazz)` Gets the result item by casting it to the specified `Class`.
    `boolean` | `getBoolean()` Gets the result item by coercing it to an `boolean`.
    `byte` | `getByte()` Gets the result item by coercing it to an `byte`.
    `double` | `getDouble()` Gets the result item by coercing it to an `double`.
    `Edge` | `getEdge()` Gets the result item by casting it to an `Edge`.
    `Element` | `getElement()` Gets the result item by casting it to an `Element`.
    `float` | `getFloat()` Gets the result item by coercing it to an `float`.
    `int` | `getInt()` Gets the result item by coercing it to an `int`.
    `long` | `getLong()` Gets the result item by coercing it to an `long`.
    `Object` | `getObject()` Gets the result item.
    `Path` | `getPath()` Gets the result item by casting it to a `Path`.
    `<V> Property<V>` | `getProperty()` Gets the result item by casting it to a `Property`.
    `short` | `getShort()` Gets the result item by coercing it to an `short`.
    `String` | `getString()` Gets the result item by coercing it to a `String` via `toString()`.
    `Vertex` | `getVertex()` Gets the result item by casting it to a `Vertex`.
    `<V> VertexProperty<V>` | `getVertexProperty()` Gets the result item by casting it to a `VertexProperty`.
    `boolean` | `isNull()` Determines if the result item is null or not.
    `String` | `toString()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Result

          public Result(Object responseData)

      Constructs a "result" from data found in `ResponseResult.getData()`.

  - ### Method Detail

    - #### getString

          public String getString()

      Gets the result item by coercing it to a `String` via `toString()`.

    - #### getInt

          public int getInt()

      Gets the result item by coercing it to an `int`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `int`.

    - #### getByte

          public byte getByte()

      Gets the result item by coercing it to an `byte`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `byte`.

    - #### getShort

          public short getShort()

      Gets the result item by coercing it to an `short`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `short`.

    - #### getLong

          public long getLong()

      Gets the result item by coercing it to an `long`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `long`.

    - #### getFloat

          public float getFloat()

      Gets the result item by coercing it to an `float`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `float`.

    - #### getDouble

          public double getDouble()

      Gets the result item by coercing it to an `double`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `double`.

    - #### getBoolean

          public boolean getBoolean()

      Gets the result item by coercing it to an `boolean`.
      Throws:
        `NumberFormatException` - if the value is not parsable as an `boolean`.

    - #### isNull

          public boolean isNull()

      Determines if the result item is null or not. This is often a good check prior to calling other methods to get the object as they could throw an unexpected `NullPointerException` if the result item is `null`.

    - #### getVertex

          public Vertex getVertex()

      Gets the result item by casting it to a `Vertex`.

    - #### getEdge

          public Edge getEdge()

      Gets the result item by casting it to an `Edge`.

    - #### getElement

          public Element getElement()

      Gets the result item by casting it to an `Element`.

    - #### getPath

          public Path getPath()

      Gets the result item by casting it to a `Path`.

    - #### getProperty

          public <V> Property<V> getProperty()

      Gets the result item by casting it to a `Property`.

    - #### getVertexProperty

          public <V> VertexProperty<V> getVertexProperty()

      Gets the result item by casting it to a `VertexProperty`.

    - #### get

          public <T> T get(Class<? extends T> clazz)

      Gets the result item by casting it to the specified `Class`.

    - #### getObject

          public Object getObject()

      Gets the result item.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2013–2022 Apache Software Foundation. All rights reserved.