Search in sources :

Example 1 with PathElement

use of com.google.datastore.v1.Key.PathElement in project beam by apache.

the class DatastoreV1 method isValidKey.

/**
   * Returns true if a Cloud Datastore key is complete. A key is complete if its last element
   * has either an id or a name.
   */
static boolean isValidKey(Key key) {
    List<PathElement> elementList = key.getPathList();
    if (elementList.isEmpty()) {
        return false;
    }
    PathElement lastElement = elementList.get(elementList.size() - 1);
    return (lastElement.getId() != 0 || !lastElement.getName().isEmpty());
}
Also used : PathElement(com.google.datastore.v1.Key.PathElement)

Aggregations

PathElement (com.google.datastore.v1.Key.PathElement)1