Class ThingEventToThingConverter
- java.lang.Object
-
- org.eclipse.ditto.things.model.signals.events.ThingEventToThingConverter
-
public final class ThingEventToThingConverter extends java.lang.ObjectHelpers and utils for convertingThingEvents toThings.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<Thing>mergeThingWithExtraFields(org.eclipse.ditto.base.model.signals.Signal<?> signal, org.eclipse.ditto.json.JsonFieldSelector extraFields, org.eclipse.ditto.json.JsonObject extra)Merge any thing information in a signal event together with extra fields from signal enrichment.static java.util.Optional<Thing>thingEventToThing(ThingEvent<?> thingEvent)Creates a Thing from the passed ThingEvent.
-
-
-
Method Detail
-
thingEventToThing
public static java.util.Optional<Thing> thingEventToThing(ThingEvent<?> thingEvent)
Creates a Thing from the passed ThingEvent.- Parameters:
thingEvent- the ThingEvent to extract the correlating Thing from- Returns:
- the Thing represented by the passed in ThingEvent
-
mergeThingWithExtraFields
public static java.util.Optional<Thing> mergeThingWithExtraFields(org.eclipse.ditto.base.model.signals.Signal<?> signal, @Nullable org.eclipse.ditto.json.JsonFieldSelector extraFields, org.eclipse.ditto.json.JsonObject extra)
Merge any thing information in a signal event together with extra fields from signal enrichment. Thing events contain thing information. All other signals do not contain thing information. Extra fields contain thing information if it is not empty. If thing information exists in any of the 2 sources, then merge the information from both sources to create a thing, with priority given to the thing information extracted by thesignal.- Parameters:
signal- the signal.extraFields- selected extra fields to enrich the signal with.extra- value of the extra fields.- Returns:
- the merged thing if thing information exists in any of the 2 sources, or an empty optional otherwise.
-
-