Class 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.AbstractNamespacedEntityId
    Java representation of a validated Thing ID.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ThingId generateRandom()
      Generates a new thing ID with the default namespace placeholder and a unique name.
      static ThingId inDefaultNamespace​(java.lang.String name)
      Returns an instance of this class with default namespace placeholder.
      static ThingId of​(java.lang.CharSequence thingId)
      Returns an instance of this class based on the given CharSequence.
      static ThingId of​(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
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        chars, codePoints, toString
      • Methods inherited from interface org.eclipse.ditto.base.model.entity.id.EntityId

        charAt, compareTo, getEntityType, length, subSequence
    • 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 given thingId is an instance of NamespacedEntityId.
        Parameters:
        thingId - the thing ID.
        Returns:
        the ID.
        Throws:
        ThingIdInvalidException - if the given thingId is 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 given name a 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.