@Override
  public Iterator columnAs(final String name) {

    final Iterator<Value> it = result.list(Records.column(name)).iterator();

    return Iterables.map(
        new Function<Value, Object>() {

          @Override
          public Object apply(final Value t) {
            return wrapper.apply(t.asObject());
          }
        },
        it);
  }
Esempio n. 2
0
  @Override
  public Iterable<S> get(
      final SecurityContext securityContext,
      final NodeInterface node,
      final Predicate<GraphObject> predicate) {

    final NodeFactory<S> nodeFactory = new NodeFactory<>(securityContext);
    final Iterable<Relationship> rels = getRawSource(securityContext, node.getNode(), predicate);

    if (rels != null) {

      return Iterables.map(
          new Function<Relationship, S>() {

            @Override
            public S apply(Relationship from) throws RuntimeException {
              return nodeFactory.instantiate(from.getStartNode(), from);
            }
          },
          sort(rels));
    }

    return null;
  }