Skip to content

Instantly share code, notes, and snippets.

@rfaita
Created July 27, 2020 13:46
Show Gist options
  • Save rfaita/432aa4ce048e6400b0384a8a96a1e161 to your computer and use it in GitHub Desktop.
Save rfaita/432aa4ce048e6400b0384a8a96a1e161 to your computer and use it in GitHub Desktop.
SensorData.java
package com.iot.edge.dto;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.HashMap;
import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class SensorData {
private String id;
private Long timestamp;
private String tenantId;
private String token;
private Map<String, Object> extraFields = new HashMap<>();
@JsonAnyGetter
public Map<String, Object> getExtraFields() {
return extraFields;
}
@JsonAnySetter
public void setExtraFields(String key, Object value) {
this.extraFields.put(key, value);
}
...all another getters and setters...
@Override
public String toString() {
return "SensorData{" +
"id='" + id + '\'' +
", timestamp=" + timestamp +
", tenantId='" + tenantId + '\'' +
", token='" + token + '\'' +
", extraFields=" + extraFields +
'}';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment