Created
July 27, 2020 13:46
-
-
Save rfaita/432aa4ce048e6400b0384a8a96a1e161 to your computer and use it in GitHub Desktop.
SensorData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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