Send feedback
Class Key (2.23.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version latest keyboard_arrow_down
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
Name
Description
urlSafe
String
Returns
Type
Description
Key
newBuilder(IncompleteKey copyFrom, String name)
public static Key.Builder newBuilder(IncompleteKey copyFrom, String name)
newBuilder(IncompleteKey copyFrom, long id)
public static Key.Builder newBuilder(IncompleteKey copyFrom, long id)
newBuilder(Key copyFrom)
public static Key.Builder newBuilder(Key copyFrom)
Parameter
Name
Description
copyFrom
Key
newBuilder(Key parent, String kind, String name)
public static Key.Builder newBuilder(Key parent, String kind, String name)
newBuilder(Key parent, String kind, long id)
public static Key.Builder newBuilder(Key parent, String kind, long id)
newBuilder(String projectId, String kind, String name)
public static Key.Builder newBuilder(String projectId, String kind, String name)
newBuilder(String projectId, String kind, String name, String databaseId)
public static Key.Builder newBuilder(String projectId, String kind, String name, String databaseId)
newBuilder(String projectId, String kind, long id)
public static Key.Builder newBuilder(String projectId, String kind, long id)
newBuilder(String projectId, String kind, long id, String databaseId)
public static Key.Builder newBuilder(String projectId, String kind, long id, String databaseId)
Methods
getId()
Returns the key's id or null
if it has a name instead.
Returns
Type
Description
Long
getName()
Returns the key's name or null
if it has an id instead.
Returns
Type
Description
String
getNameOrId()
public Object getNameOrId()
Returns the key's ID (as Long ) or name (as String ). Never null
.
Returns
Type
Description
Object
hasId()
hasName()
toUrlSafe()
public String toUrlSafe()
Returns the key in an encoded form that can be used as part of a URL.
Returns
Type
Description
String
Send feedback
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-10-30 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-30 UTC."],[],[]]