/** * Returns the {@link ObjectNode} representing the time granularity spec. * <p>Only contains fields with non-default value. * <p>NOTE: here we use {@link ObjectNode} to preserve the insertion order. */ public ObjectNode toJsonObject() { ObjectNode jsonObject = JsonUtils.newObjectNode(); jsonObject.put("name", _name); jsonObject.put("dataType", _dataType.name()); jsonObject.put("timeType", _timeType.name()); if (_timeUnitSize != DEFAULT_TIME_UNIT_SIZE) { jsonObject.put("timeUnitSize", _timeUnitSize); } if (!_timeFormat.equals(DEFAULT_TIME_FORMAT)) { jsonObject.put("timeFormat", _timeFormat); } return jsonObject; }
/** * Returns the {@link ObjectNode} representing the field spec. * <p>Only contains fields with non-default value. * <p>NOTE: here we use {@link ObjectNode} to preserve the insertion order. */ public ObjectNode toJsonObject() { ObjectNode jsonObject = JsonUtils.newObjectNode(); jsonObject.put("name", _name); jsonObject.put("dataType", _dataType.name()); if (!_isSingleValueField) { jsonObject.put("singleValueField", false); } if (_maxLength != DEFAULT_MAX_LENGTH) { jsonObject.put("maxLength", _maxLength); } appendDefaultNullValue(jsonObject); return jsonObject; }