@Override
    public void addStart(final Traverser.Admin<S> start) {
        final S s = start.get();
        if (s instanceof Element)
            this.e = (E) this.t.apply((Element) start.get());
        else if (s instanceof Property) {
            // T.apply() doesn't work on Property because the inheritance hierarchy doesn't make it an Element. have
            // to special case it here. only T.key/value make any sense for it.
            if (t == T.key)
                this.e = (E) ((Property) s).key();
            else if (t == T.value)
                this.e = ((Property<E>) s).value();
            else
                throw new IllegalStateException(String.format("TokenTraversal support of Property does not allow selection by %s", t));
        } else
            throw new IllegalStateException(String.format("TokenTraversal support of %s does not allow selection by %s", s.getClass().getName(), t));

    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/TokenTraversal.java