Package org.eclipse.ditto.things.model
Class ThingId
java.lang.Object
org.eclipse.ditto.base.model.entity.id.AbstractEntityId
org.eclipse.ditto.base.model.entity.id.AbstractNamespacedEntityId
org.eclipse.ditto.things.model.ThingId
- All Implemented Interfaces:
CharSequence,Comparable<org.eclipse.ditto.base.model.entity.id.EntityId>,org.eclipse.ditto.base.model.entity.id.EntityId,org.eclipse.ditto.base.model.entity.id.NamespacedEntityId
@Immutable
public final class ThingId
extends org.eclipse.ditto.base.model.entity.id.AbstractNamespacedEntityId
Java representation of a validated Thing ID.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ThingIdGenerates a new thing ID with the default namespace placeholder and a unique name.static ThingIdgenerateRandom(String namespace) Generates a new thing ID with the specified namespace placeholder or a default namespace if null is passed along with a unique namestatic ThingIdinDefaultNamespace(String name) Returns an instance of this class with default namespace placeholder.static ThingIdinNamespaceWithRandomName(String namespace) Generates a thing ID with a random unique name inside the given namespace.static ThingIdof(CharSequence thingId) Returns an instance of this class based on the given CharSequence.static ThingIdReturns an instance of this class with the given namespace and name.Methods inherited from class org.eclipse.ditto.base.model.entity.id.AbstractNamespacedEntityId
getName, getNamespaceMethods inherited from class org.eclipse.ditto.base.model.entity.id.AbstractEntityId
equals, getEntityType, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty, toStringMethods inherited from interface org.eclipse.ditto.base.model.entity.id.EntityId
charAt, compareTo, getEntityType, length, subSequence
-
Method Details
-
of
Returns an instance of this class based on the given CharSequence. May return the same instance as the parameter if the given parameter is already a ThingId. Skips validation if the giventhingIdis an instance of NamespacedEntityId.- Parameters:
thingId- the thing ID.- Returns:
- the ID.
- Throws:
ThingIdInvalidException- if the giventhingIdis invalid.
-
of
Returns an instance of this class with the given namespace and name.- Parameters:
namespace- the namespace of the thing.name- the name of the thing.- Returns:
- the created ID.
-
inNamespaceWithRandomName
Generates a thing ID with a random unique name inside the given namespace.- Parameters:
namespace- the namespace of the thing.- Returns:
- The generated unique thing ID.
- Throws:
ThingIdInvalidException- if for the givennamespacea ThingId cannot be derived.- Since:
- 3.0.0
-
inDefaultNamespace
Returns an instance of this class with default namespace placeholder.- Parameters:
name- the name of the thing.- Returns:
- the created ID.
- Throws:
ThingIdInvalidException- if for the givennamea ThingId cannot be derived.
-
generateRandom
Generates a new thing ID with the default namespace placeholder and a unique name.- Returns:
- the generated thing ID.
-
generateRandom
Generates a new thing ID with the specified namespace placeholder or a default namespace if null is passed along with a unique name- Parameters:
namespace- the specified namespace- Returns:
- the generated thing ID
-