Class ImmutableFeatureChange

  • All Implemented Interfaces:
    org.eclipse.ditto.base.model.entity.id.WithEntityId, org.eclipse.ditto.base.model.entity.type.WithEntityType, org.eclipse.ditto.base.model.headers.DittoHeadersSettable<Change>, org.eclipse.ditto.base.model.headers.WithDittoHeaders, org.eclipse.ditto.base.model.signals.WithFeatureId, Acknowledgeable, Change, FeatureChange

    @Immutable
    public final class ImmutableFeatureChange
    extends java.lang.Object
    implements FeatureChange
    An immutable implementation of FeatureChange.
    Since:
    1.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableFeatureChange​(org.eclipse.ditto.base.model.entity.id.EntityId entityId, ChangeAction changeAction, org.eclipse.ditto.things.model.Feature feature, org.eclipse.ditto.json.JsonPointer path, long revision, java.time.Instant timestamp, org.eclipse.ditto.json.JsonObject extra, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders, java.util.function.Consumer<org.eclipse.ditto.base.model.signals.acks.Acknowledgement> acknowledgementPublisher)
      Constructs a new ImmutableFeatureChange object.
      ImmutableFeatureChange​(Change change, org.eclipse.ditto.things.model.Feature feature)
      Constructs a new ImmutableFeatureChange object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      ChangeAction getAction()
      Returns the ChangeAction which caused this change.
      org.eclipse.ditto.base.model.headers.DittoHeaders getDittoHeaders()  
      org.eclipse.ditto.base.model.entity.id.EntityId getEntityId()  
      org.eclipse.ditto.base.model.entity.type.EntityType getEntityType()  
      java.util.Optional<org.eclipse.ditto.json.JsonObject> getExtra()
      Returns the extra information which enriches the actual value of this change.
      org.eclipse.ditto.things.model.Feature getFeature()
      Returns the Feature which was object of the change.
      org.eclipse.ditto.json.JsonPointer getPath()
      Returns the relative path (relative to the change registration) of the changed JSON field.
      long getRevision()
      Returns the revision (change counter) of the change.
      java.util.Optional<java.time.Instant> getTimestamp()
      Returns the timestamp of the change.
      java.util.Optional<org.eclipse.ditto.json.JsonValue> getValue()
      Returns the optional value of the changed JSON field.
      void handleAcknowledgementRequest​(org.eclipse.ditto.base.model.acks.AcknowledgementLabel acknowledgementLabel, java.util.function.Consumer<AcknowledgementRequestHandle> acknowledgementHandle)
      Handles an AcknowledgementRequest identified by the passed acknowledgementLabel issued by the Ditto backend for a received signal translated into this Acknowledgeable by invoking the passed acknowledgementHandle consumer with a client side AcknowledgementHandle - if the passed acknowledgementLabel was present in the requested acknowledgements.
      void handleAcknowledgementRequests​(java.util.function.Consumer<java.util.Collection<AcknowledgementRequestHandle>> acknowledgementHandles)
      Handles AcknowledgementRequests issued by the Ditto backend for a received signal translated into this Acknowledgeable by invoking the passed acknowledgementHandles consumer with client side AcknowledgementHandles.
      int hashCode()  
      Change setDittoHeaders​(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)  
      java.lang.String toString()  
      ImmutableFeatureChange withExtra​(org.eclipse.ditto.json.JsonObject extra)
      Sets the given extra information which enriches the actual value of the change.
      Change withPathAndValue​(org.eclipse.ditto.json.JsonPointer path, org.eclipse.ditto.json.JsonValue value)
      Sets the given path and value into the change.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ImmutableFeatureChange

        public ImmutableFeatureChange​(org.eclipse.ditto.base.model.entity.id.EntityId entityId,
                                      ChangeAction changeAction,
                                      @Nullable
                                      org.eclipse.ditto.things.model.Feature feature,
                                      org.eclipse.ditto.json.JsonPointer path,
                                      long revision,
                                      @Nullable
                                      java.time.Instant timestamp,
                                      @Nullable
                                      org.eclipse.ditto.json.JsonObject extra,
                                      org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders,
                                      java.util.function.Consumer<org.eclipse.ditto.base.model.signals.acks.Acknowledgement> acknowledgementPublisher)
        Constructs a new ImmutableFeatureChange object.
        Parameters:
        entityId - the identifier of the changed Thing.
        feature - the Feature which was changed.
        changeAction - the operation which caused the change.
        path - the JsonPointer of the changed json field.
        revision - the revision (change counter) of the change.
        timestamp - the timestamp of the change.
        extra - the extra data to be included in the change.
        dittoHeaders - the DittoHeaders of the event which lead to the change.
        acknowledgementPublisher - the consumer for publishing built acknowledgements to the Ditto backend.
        Throws:
        java.lang.NullPointerException - if any required argument is null.
      • ImmutableFeatureChange

        public ImmutableFeatureChange​(Change change,
                                      @Nullable
                                      org.eclipse.ditto.things.model.Feature feature)
        Constructs a new ImmutableFeatureChange object.
        Parameters:
        change - the change to use for delegation.
        feature - the additional Feature this FeatureChange is aware of.
        Throws:
        java.lang.NullPointerException - if change is null.
        Since:
        1.1.0
    • Method Detail

      • getEntityId

        public org.eclipse.ditto.base.model.entity.id.EntityId getEntityId()
        Specified by:
        getEntityId in interface org.eclipse.ditto.base.model.entity.id.WithEntityId
      • getEntityType

        public org.eclipse.ditto.base.model.entity.type.EntityType getEntityType()
        Specified by:
        getEntityType in interface org.eclipse.ditto.base.model.entity.type.WithEntityType
      • getPath

        public org.eclipse.ditto.json.JsonPointer getPath()
        Description copied from interface: Change
        Returns the relative path (relative to the change registration) of the changed JSON field.
        Specified by:
        getPath in interface Change
        Returns:
        the relative path of the changed JSON field.
      • getValue

        public java.util.Optional<org.eclipse.ditto.json.JsonValue> getValue()
        Description copied from interface: Change
        Returns the optional value of the changed JSON field.
        Specified by:
        getValue in interface Change
        Returns:
        the optional value of the changed JSON field.
      • getFeature

        public org.eclipse.ditto.things.model.Feature getFeature()
        Description copied from interface: FeatureChange
        Returns the Feature which was object of the change.
        Specified by:
        getFeature in interface FeatureChange
        Returns:
        the modified Feature.
      • getRevision

        public long getRevision()
        Description copied from interface: Change
        Returns the revision (change counter) of the change.
        Specified by:
        getRevision in interface Change
        Returns:
        the revision of the change.
      • getTimestamp

        public java.util.Optional<java.time.Instant> getTimestamp()
        Description copied from interface: Change
        Returns the timestamp of the change.
        Specified by:
        getTimestamp in interface Change
        Returns:
        the timestamp of the change.
      • getExtra

        public java.util.Optional<org.eclipse.ditto.json.JsonObject> getExtra()
        Description copied from interface: Change
        Returns the extra information which enriches the actual value of this change.
        Specified by:
        getExtra in interface Change
        Returns:
        the extra data or an empty Optional.
      • withExtra

        public ImmutableFeatureChange withExtra​(@Nullable
                                                org.eclipse.ditto.json.JsonObject extra)
        Description copied from interface: Change
        Sets the given extra information which enriches the actual value of the change. Previously set extra is replaced.
        Specified by:
        withExtra in interface Change
        Parameters:
        extra - the extra data information or null.
        Returns:
        a new instance of this change with the added extra data.
      • getDittoHeaders

        public org.eclipse.ditto.base.model.headers.DittoHeaders getDittoHeaders()
        Specified by:
        getDittoHeaders in interface org.eclipse.ditto.base.model.headers.WithDittoHeaders
      • setDittoHeaders

        public Change setDittoHeaders​(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
        Specified by:
        setDittoHeaders in interface org.eclipse.ditto.base.model.headers.DittoHeadersSettable<Change>
      • handleAcknowledgementRequests

        public void handleAcknowledgementRequests​(java.util.function.Consumer<java.util.Collection<AcknowledgementRequestHandle>> acknowledgementHandles)
        Description copied from interface: Acknowledgeable
        Handles AcknowledgementRequests issued by the Ditto backend for a received signal translated into this Acknowledgeable by invoking the passed acknowledgementHandles consumer with client side AcknowledgementHandles.
        Specified by:
        handleAcknowledgementRequests in interface Acknowledgeable
        Parameters:
        acknowledgementHandles - the consumer to invoke with a collection of AcknowledgementHandles used to send back Acknowledgements.
      • withPathAndValue

        public Change withPathAndValue​(org.eclipse.ditto.json.JsonPointer path,
                                       @Nullable
                                       org.eclipse.ditto.json.JsonValue value)
        Description copied from interface: Change
        Sets the given path and value into the change.
        Specified by:
        withPathAndValue in interface Change
        Parameters:
        path - the relative path of the changed JSON field.
        value - the optional value of the changed JSON field.
        Returns:
        a new instance of this change with the added data.
      • handleAcknowledgementRequest

        public void handleAcknowledgementRequest​(org.eclipse.ditto.base.model.acks.AcknowledgementLabel acknowledgementLabel,
                                                 java.util.function.Consumer<AcknowledgementRequestHandle> acknowledgementHandle)
        Description copied from interface: Acknowledgeable
        Handles an AcknowledgementRequest identified by the passed acknowledgementLabel issued by the Ditto backend for a received signal translated into this Acknowledgeable by invoking the passed acknowledgementHandle consumer with a client side AcknowledgementHandle - if the passed acknowledgementLabel was present in the requested acknowledgements.
        Specified by:
        handleAcknowledgementRequest in interface Acknowledgeable
        Parameters:
        acknowledgementLabel - the AcknowledgementLabel which should be handled - if present - by the passed acknowledgementHandle.
        acknowledgementHandle - the consumer to invoke with a AcknowledgementHandle used to send back an Acknowledgement.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object