public class EditorKey
extends java.lang.Object
implements java.io.Serializable
EditorKey represents a globally-unique ID to an object created in the Meridian Editor. Objects created in the Editor can have multiple ID components and this class helps locate an object based on the various components needed.
Here’s an example: A Meridian “Placemark” has an ID (Placemark.key
), but it is only unique to the parent Map containing it. The Map also has an ID, but it is only unique to the parent App containing it. The App has its own ID, which is globally unique, and so that is the root key with a null
parent.
Putting it all together:
String placemarkId = placemarkKey.getId();
String placemarkMapId = placemarkKey.getParent().getId();
String placemarkAppId = placemarkKey.getParent().getParent().getId();
Constructor and Description |
---|
EditorKey(java.lang.String id)
Constructor for a new
EditorKey , the parent key will be null . |
EditorKey(java.lang.String id,
EditorKey parent)
Constructor for a new
EditorKey . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static EditorKey |
forApp(java.lang.String appId)
Constructs an
EditorKey to a known Meridian App ID |
static EditorKey |
forMap(java.lang.String mapId,
EditorKey appKey)
Constructs an
EditorKey to a known Meridian Map ID found in the given Meridian App ID. |
static EditorKey |
forMap(java.lang.String mapId,
java.lang.String appId)
Constructs an
EditorKey to a known Meridian Map ID found in the given Meridian App ID. |
static EditorKey |
forPlacemark(java.lang.String placemarkId,
EditorKey mapKey)
Constructs a key to a known Meridian Placemark ID found in the Meridian Map with the given key.
|
static EditorKey |
forPlacemark(java.lang.String placemarkId,
java.lang.String mapId,
java.lang.String appId)
Constructs a key to a known Meridian Placemark ID found in the Meridian Map and App with the given ids.
|
static EditorKey |
fromJSON(org.json.JSONObject jsonObject) |
static EditorKey |
fromJSON(java.lang.String json) |
java.lang.String |
getId() |
EditorKey |
getParent() |
int |
hashCode() |
org.json.JSONObject |
toJSON() |
java.lang.String |
toString() |
public EditorKey(java.lang.String id, EditorKey parent)
Constructor for a new EditorKey
.
id
- The Meridian ID of a known key, must not be null
or empty.parent
- The known parent key for this Meridian ID, may be null
.java.lang.IllegalArgumentException
- if ID is invalidpublic EditorKey(java.lang.String id)
Constructor for a new EditorKey
, the parent key will be null
.
id
- The Meridian ID of a known key, must not be null.java.lang.IllegalArgumentException
- if ID is invalidpublic java.lang.String getId()
public EditorKey getParent()
public static EditorKey forApp(@NonNull java.lang.String appId)
Constructs an EditorKey
to a known Meridian App ID
appId
- The Meridian App ID for the returned key. must not be null
or emptyjava.lang.IllegalArgumentException
- if appId is invalidpublic static EditorKey forMap(java.lang.String mapId, java.lang.String appId)
Constructs an EditorKey
to a known Meridian Map ID found in the given Meridian App ID.
mapId
- The Meridian Map ID for the returned key, must not be null
or emptyappId
- The Meridian App ID for the returned key. must not be null
or emptyjava.lang.IllegalArgumentException
- if mapId or appId is invalidpublic static EditorKey forMap(java.lang.String mapId, @NonNull EditorKey appKey)
Constructs an EditorKey
to a known Meridian Map ID found in the given Meridian App ID.
mapId
- The Meridian Map ID for the returned key, must not be null
or emptyappKey
- The Meridian App Key for the returned key. must not be null
or emptyjava.lang.IllegalArgumentException
- if mapId or appKey is invalidpublic static EditorKey forPlacemark(java.lang.String placemarkId, EditorKey mapKey)
Constructs a key to a known Meridian Placemark ID found in the Meridian Map with the given key.
placemarkId
- A known Meridian Placemark ID, must not be null
or emptymapKey
- A known Meridian Map key, must not be null
or emptyjava.lang.IllegalArgumentException
- if mapKey or placemarkId is invalidpublic static EditorKey forPlacemark(java.lang.String placemarkId, java.lang.String mapId, java.lang.String appId)
Constructs a key to a known Meridian Placemark ID found in the Meridian Map and App with the given ids.
placemarkId
- A known Meridian Placemark ID, must not be null
or emptymapId
- A known Meridian Map id, must not be null
or emptyappId
- A known Meridian App id, must not be null
or emptyjava.lang.IllegalArgumentException
- if mapId or appId or placemarkId is invalidpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public org.json.JSONObject toJSON()
public static EditorKey fromJSON(java.lang.String json)
public static EditorKey fromJSON(org.json.JSONObject jsonObject)
public int hashCode()
hashCode
in class java.lang.Object