@Override public IncompleteKey build() { ImmutableList<PathElement> path = ImmutableList.<PathElement>builder().addAll(ancestors).add(PathElement.of(kind)).build(); return new IncompleteKey(projectId, namespace, path); } }
public IncompleteKey newKey() { ImmutableList<PathElement> path = ImmutableList.<PathElement>builder().addAll(ancestors).add(PathElement.of(kind)).build(); return new IncompleteKey(projectId, namespace, path); }
static IncompleteKey fromPb(com.google.datastore.v1.Key keyPb) { String projectId = ""; String namespace = ""; if (keyPb.hasPartitionId()) { com.google.datastore.v1.PartitionId partitionIdPb = keyPb.getPartitionId(); projectId = partitionIdPb.getProjectId(); namespace = partitionIdPb.getNamespaceId(); } List<com.google.datastore.v1.Key.PathElement> pathElementsPb = keyPb.getPathList(); Preconditions.checkArgument(!pathElementsPb.isEmpty(), "Path must not be empty"); ImmutableList.Builder<PathElement> pathBuilder = ImmutableList.builder(); for (com.google.datastore.v1.Key.PathElement pathElementPb : pathElementsPb) { pathBuilder.add(PathElement.fromPb(pathElementPb)); } ImmutableList<PathElement> path = pathBuilder.build(); PathElement leaf = path.get(path.size() - 1); if (leaf.getNameOrId() != null) { return new Key(projectId, namespace, path); } return new IncompleteKey(projectId, namespace, path); }
public IncompleteKey newKey() { ImmutableList<PathElement> path = ImmutableList.<PathElement>builder().addAll(ancestors).add(PathElement.of(kind)).build(); return new IncompleteKey(projectId, namespace, path); }
@Override public IncompleteKey build() { ImmutableList<PathElement> path = ImmutableList.<PathElement>builder().addAll(ancestors).add(PathElement.of(kind)).build(); return new IncompleteKey(projectId, namespace, path); } }
static IncompleteKey fromPb(com.google.datastore.v1.Key keyPb) { String projectId = ""; String namespace = ""; if (keyPb.hasPartitionId()) { com.google.datastore.v1.PartitionId partitionIdPb = keyPb.getPartitionId(); projectId = partitionIdPb.getProjectId(); namespace = partitionIdPb.getNamespaceId(); } List<com.google.datastore.v1.Key.PathElement> pathElementsPb = keyPb.getPathList(); Preconditions.checkArgument(!pathElementsPb.isEmpty(), "Path must not be empty"); ImmutableList.Builder<PathElement> pathBuilder = ImmutableList.builder(); for (com.google.datastore.v1.Key.PathElement pathElementPb : pathElementsPb) { pathBuilder.add(PathElement.fromPb(pathElementPb)); } ImmutableList<PathElement> path = pathBuilder.build(); PathElement leaf = path.get(path.size() - 1); if (leaf.getNameOrId() != null) { return new Key(projectId, namespace, path); } return new IncompleteKey(projectId, namespace, path); }