|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.appengine.api.datastore.KeyFactory.Builder
public static final class KeyFactory.Builder
Helper class that aids in the construction of Keys
with
ancestors. Initialize the Builder
with the topmost ancestor
in your key path and then add children using the addChild(java.lang.String, java.lang.String)
overload that best suits your needs. When finished adding children,
call getKey()
to retrieve your Key
or
getString()
to retrieve your Key
encoded as a websafe
String
.
Examples:
import com.google.appengine.api.datastore.KeyFactory.Builder; ... Key key = new Builder("Person", 88).addChild("Address", 24).getKey(); String keyStr = new Builder("Photo Album", "Vacation").addChild("Photo", 1424).getString();
Constructor Summary | |
---|---|
KeyFactory.Builder(Key key)
Create a Builder , establishing the provided Key as the
topmost ancestor. |
|
KeyFactory.Builder(java.lang.String kind,
long id)
Create a Builder , establishing a Key constructed from
the provided kind and id as the topmost ancestor. |
|
KeyFactory.Builder(java.lang.String kind,
java.lang.String name)
Create a Builder , establishing a Key constructed from
the provided kind and name as the topmost ancestor. |
Method Summary | |
---|---|
KeyFactory.Builder |
addChild(java.lang.String kind,
long id)
Add a Key constructed from the provided kind and id
as the child of the Key most recently added to the
Builder . |
KeyFactory.Builder |
addChild(java.lang.String kind,
java.lang.String name)
Add a Key constructed from the provided kind and name
as the child of the Key most recently added to the
Builder . |
Key |
getKey()
|
java.lang.String |
getString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyFactory.Builder(java.lang.String kind, java.lang.String name)
Builder
, establishing a Key
constructed from
the provided kind and name as the topmost ancestor.
kind
- the kind of the topmost ancestorname
- the name of the topmost ancestor in kind
, as an
arbitrary string unique across root entities of this kind
public KeyFactory.Builder(java.lang.String kind, long id)
Builder
, establishing a Key
constructed from
the provided kind and id as the topmost ancestor.
kind
- the kind of the topmost ancestorid
- the numeric identifier of the topmost ancestor in kind
,
unique across root entities of this kind, must not be zeropublic KeyFactory.Builder(Key key)
Builder
, establishing the provided Key
as the
topmost ancestor.
key
- the topmost ancestorMethod Detail |
---|
public KeyFactory.Builder addChild(java.lang.String kind, java.lang.String name)
Key
constructed from the provided kind and name
as the child of the Key
most recently added to the
Builder
.
kind
- the kind of the childname
- the name of the child in kind
, as an arbitrary string
unique across entities of this kind
with the same parent
this
public KeyFactory.Builder addChild(java.lang.String kind, long id)
Key
constructed from the provided kind and id
as the child of the Key
most recently added to the
Builder
.
kind
- the kind of the childid
- the numeric identifier of the child in kind
,
unique across entities of this kind with the same parent, must not be
zero
this
public Key getKey()
Key
.public java.lang.String getString()
Key
, encoded as a websafe
String
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |