public final class Key extends IncompleteKey
Entity.
This class is immutable.| Modifier and Type | Class and Description |
|---|---|
static class |
Key.Builder |
| Modifier and Type | Method and Description |
|---|---|
static Key.Builder |
builder(IncompleteKey copyFrom,
long id) |
static Key.Builder |
builder(IncompleteKey copyFrom,
String name) |
static Key.Builder |
builder(Key copyFrom) |
static Key.Builder |
builder(Key parent,
String kind,
long id) |
static Key.Builder |
builder(Key parent,
String kind,
String name) |
static Key.Builder |
builder(String projectId,
String kind,
long id) |
static Key.Builder |
builder(String projectId,
String kind,
String name) |
static Key |
fromUrlSafe(String urlSafe)
Create a
Key given its URL safe encoded form. |
boolean |
hasId() |
boolean |
hasName() |
Long |
id()
Returns the key's id or
null if it has a name instead. |
String |
name()
Returns the key's name or
null if it has an id instead. |
Object |
nameOrId()
|
String |
toUrlSafe()
Returns the key in an encoded form that can be used as part of a URL.
|
builder, builder, builder, parentpublic boolean hasId()
public Long id()
null if it has a name instead.public boolean hasName()
public String name()
null if it has an id instead.public Object nameOrId()
public String toUrlSafe()
public static Key fromUrlSafe(String urlSafe)
Key given its URL safe encoded form.IllegalArgumentException - when decoding failspublic static Key.Builder builder(String projectId, String kind, String name)
public static Key.Builder builder(String projectId, String kind, long id)
public static Key.Builder builder(Key copyFrom)
public static Key.Builder builder(IncompleteKey copyFrom, String name)
public static Key.Builder builder(IncompleteKey copyFrom, long id)
public static Key.Builder builder(Key parent, String kind, String name)
public static Key.Builder builder(Key parent, String kind, long id)
Copyright © 2016 Google. All rights reserved.