コード例 #1
0
  @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);
  }
コード例 #2
0
ファイル: ManyStartpoint.java プロジェクト: structr/structr
  @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;
  }