/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.tinkerpop.gremlin.driver;

import org.apache.tinkerpop.gremlin.driver.message.ResponseResult;
import org.apache.tinkerpop.gremlin.process.traversal.Path;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;

import java.util.Iterator;

/**
 * A {@code Result} represents an result value from the server (i.e. one item from the server-side {@link Iterator}
 * of results.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public final class Result {
    final Object resultObject;

    /**
     * Constructs a "result" from data found in {@link ResponseResult#getData()}.
     */
    public Result(final Object responseData) {
        this.resultObject = responseData;
    }

    /**
     * Gets the result item by coercing it to a {@code String} via {@code toString()}.
     */
    public String getString() {
        return resultObject.toString();
    }

    /**
     * Gets the result item by coercing it to an {@code int}.
     *
     * @throws NumberFormatException if the value is not parsable as an {@code int}.
     */
    public int getInt() {
        return Integer.parseInt(resultObject.toString());
    }

    /**
     * Gets the result item by coercing it to an {@code byte}.
     *
     * @throws NumberFormatException if the value is not parsable as an {@code byte}.
     */
    public byte getByte() {
        return Byte.parseByte(resultObject.toString());
    }

    /**
     * Gets the result item by coercing it to an {@code short}.
     *
     * @throws NumberFormatException if the value is not parsable as an {@code short}.
     */
    public short getShort() {
        return Short.parseShort(resultObject.toString());
    }

    /**
     * Gets the result item by coercing it to an {@code long}.
     *
     * @throws NumberFormatException if the value is not parsable as an {@code long}.
     */
    public long getLong() {
        return Long.parseLong(resultObject.toString());
    }

    /**
     * Gets the result item by coercing it to an {@code float}.
     *
     * @throws NumberFormatException if the value is not parsable as an {@code float}.
     */
    public float getFloat() {
        return Float.parseFloat(resultObject.toString());
    }

    public double getDouble() {
        return Double.parseDouble(resultObject.toString());
    }

    /**
     * Gets the result item by coercing it to an {@code boolean}.
     *
     * @throws NumberFormatException if the value is not parsable as an {@code boolean}.
     */
    public boolean getBoolean() {
        return Boolean.parseBoolean(resultObject.toString());
    }

    /**
     * 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 {@link NullPointerException} if the result item is
     * {@code null}.
     */
    public boolean isNull() {
        return null == resultObject;
    }

    /**
     * Gets the result item by casting it to a {@link Vertex}.
     */
    public Vertex getVertex() {
        return (Vertex) resultObject;
    }
    /**
     * Gets the result item by casting it to an {@link Edge}.
     */
    public Edge getEdge() {
        return (Edge) resultObject;
    }
    /**
     * Gets the result item by casting it to an {@link Element}.
     */
    public Element getElement() {
        return (Element) resultObject;
    }

    /**
     * Gets the result item by casting it to a {@link Path}.
     */
    public Path getPath() {
        return (Path) resultObject;
    }

    /**
     * Gets the result item by casting it to a {@link Property}.
     */
    public <V> Property<V> getProperty() {
        return (Property<V>) resultObject;
    }

    /**
     * Gets the result item by casting it to a {@link VertexProperty}.
     */
    public <V> VertexProperty<V> getVertexProperty() {
        return (VertexProperty<V>) resultObject;
    }

    /**
     * Gets the result item by casting it to the specified {@link Class}.
     */
    public <T> T get(final Class<? extends T> clazz) {
        return clazz.cast(this.resultObject);
    }

    /**
     * Gets the result item.
     */
    public Object getObject() {
        return this.resultObject;
    }

    @Override
    public String toString() {
        final String c = resultObject != null ? resultObject.getClass().getCanonicalName() : "null";
        return "result{" +
                "object=" + resultObject + " " +
                "class=" + c +
                '}';
    }
}

@@ -1316,17 +1316,16 @@
 esents a
-n
  result 
@@ -1349,75 +1349,182 @@
 rver
- (i.e. one item from the server-side %7B@link Iterator%7D%0A * of results
+-side %7B@link Iterator%7D of results.  This would be%0A * one item from that result set.  This class provides methods for coercing the result %7B@link Object%7D to an%0A * expected type
 .%0A *
@@ -3344,24 +3344,200 @@
 ());%0A    %7D%0A%0A
+    /**%0A     * Gets the result item by coercing it to an %7B@code double%7D.%0A     *%0A     * @throws NumberFormatException if the value is not parsable as an %7B@code double%7D.%0A     */%0A
     public d

Update javadoc.