public Map<String, Object> transform(JSONObject input, Context context, Map<String, Object>... sensorConfig) { if(getInput() == null || getInput().isEmpty()) { return transformation.map(input, getOutput(), config, context, sensorConfig); } else { Map<String, Object> in = new HashMap<>(); for(String inputField : getInput()) { in.put(inputField, input.get(inputField)); } return transformation.map(in, getOutput(), config, context, sensorConfig); } }
@Override public int hashCode() { int result = getInput() != null ? getInput().hashCode() : 0; result = 31 * result + (getOutput() != null ? getOutput().hashCode() : 0); result = 31 * result + (getTransformation() != null ? getTransformation().hashCode() : 0); result = 31 * result + (getConfig() != null ? getConfig().hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FieldTransformer that = (FieldTransformer) o; if (getInput() != null ? !getInput().equals(that.getInput()) : that.getInput() != null) return false; if (getOutput() != null ? !getOutput().equals(that.getOutput()) : that.getOutput() != null) return false; if (getTransformation() != null ? !getTransformation().equals(that.getTransformation()) : that.getTransformation() != null) return false; return getConfig() != null ? getConfig().equals(that.getConfig()) : that.getConfig() == null; }