Class Key (2.2.10)
Stay organized with collections
Save and categorize content based on your preferences.
public final class Key extends IncompleteKey
Static Methods
fromUrlSafe(String urlSafe)
public static Key fromUrlSafe(String urlSafe)
Create a Key
given its URL safe encoded form.
Parameter
Returns
newBuilder(IncompleteKey copyFrom, String name)
public static Key.Builder newBuilder(IncompleteKey copyFrom, String name)
Parameters
Returns
newBuilder(IncompleteKey copyFrom, long id)
public static Key.Builder newBuilder(IncompleteKey copyFrom, long id)
Parameters
Returns
newBuilder(Key copyFrom)
public static Key.Builder newBuilder(Key copyFrom)
Parameter
Name | Description |
copyFrom | Key
|
Returns
newBuilder(Key parent, String kind, String name)
public static Key.Builder newBuilder(Key parent, String kind, String name)
Parameters
Returns
newBuilder(Key parent, String kind, long id)
public static Key.Builder newBuilder(Key parent, String kind, long id)
Parameters
Returns
newBuilder(String projectId, String kind, String name)
public static Key.Builder newBuilder(String projectId, String kind, String name)
Parameters
Returns
newBuilder(String projectId, String kind, long id)
public static Key.Builder newBuilder(String projectId, String kind, long id)
Parameters
Returns
Methods
getId()
Returns the key's id or null
if it has a name instead.
Returns
getName()
Returns the key's name or null
if it has an id instead.
Returns
getNameOrId()
public Object getNameOrId()
Returns the key's ID (as Long) or name (as String). Never null
.
Returns
hasId()
Returns
hasName()
Returns
toUrlSafe()
public String toUrlSafe()
Returns the key in an encoded form that can be used as part of a URL.
Returns
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-05-01 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]