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:
java.lang.CharSequence,java.lang.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.AbstractNamespacedEntityIdJava representation of a validated Thing ID.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThingIdgenerateRandom()Generates a new thing ID with the default namespace placeholder and a unique name.static ThingIdinDefaultNamespace(java.lang.String name)Returns an instance of this class with default namespace placeholder.static ThingIdof(java.lang.CharSequence thingId)Returns an instance of this class based on the given CharSequence.static ThingIdof(java.lang.String namespace, java.lang.String name)Returns an instance of this class with the given namespace and name.-
Methods inherited from class org.eclipse.ditto.base.model.entity.id.AbstractNamespacedEntityId
getName, getNamespace
-
Methods inherited from class org.eclipse.ditto.base.model.entity.id.AbstractEntityId
equals, getEntityType, hashCode, toString
-
-
-
-
Method Detail
-
of
public static ThingId of(java.lang.CharSequence thingId)
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
public static ThingId of(java.lang.String namespace, java.lang.String name)
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.
-
inDefaultNamespace
public static ThingId inDefaultNamespace(java.lang.String name)
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
public static ThingId generateRandom()
Generates a new thing ID with the default namespace placeholder and a unique name.- Returns:
- the generated thing ID.
-
-