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 Details

    • Result

      public Result(Object responseData)
      Constructs a "result" from data found in ResponseResult.getData().
  • Method Details

    • 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