Class ThingEventToThingConverter
java.lang.Object
org.eclipse.ditto.things.model.signals.events.ThingEventToThingConverter
Helpers and utils for converting
ThingEvents to Things.-
Method Summary
Modifier and TypeMethodDescriptionmergeThingWithExtraFields(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.thingEventToThing(ThingEvent<?> thingEvent) Creates a Thing from the passed ThingEvent.
-
Method Details
-
thingEventToThing
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 Optional<Thing> mergeThingWithExtraFields(@Nullable 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.
-