/** * Get symbols for a {@link InputType#ENUM} type. * @return */ public JsonArray getSymbols() { if (this.type.equals(ENUM)) { return getDataType().get(ENUM_SYMBOLS_KEY).getAsJsonArray(); } return new JsonArray(); }
/** * Builds a {@link JsonSchema} object for a given {@link InputType} object. * @param type * @return */ public static JsonSchema buildBaseSchema(InputType type) { JsonObject jsonObject = new JsonObject(); JsonObject dataType = new JsonObject(); jsonObject.addProperty(COLUMN_NAME_KEY, DEFAULT_RECORD_COLUMN_NAME); dataType.addProperty(TYPE_KEY, type.toString()); jsonObject.add(DATA_TYPE_KEY, dataType); return new JsonSchema(jsonObject); }
public JsonSchema(JsonObject jsonobject) { setJsonSchemaProperties(jsonobject); this.type = InputType.valueOf(getDataType().get(TYPE_KEY).getAsString().toUpperCase()); }
/** * Builds a {@link JsonSchema} object for a given {@link InputType} object. * @param type * @return */ public static JsonSchema buildBaseSchema(InputType type) { JsonObject jsonObject = new JsonObject(); JsonObject dataType = new JsonObject(); jsonObject.addProperty(COLUMN_NAME_KEY, DEFAULT_RECORD_COLUMN_NAME); dataType.addProperty(TYPE_KEY, type.toString()); jsonObject.add(DATA_TYPE_KEY, dataType); return new JsonSchema(jsonObject); }
public JsonSchema(JsonObject jsonobject) { setJsonSchemaProperties(jsonobject); this.type = InputType.valueOf(getDataType().get(TYPE_KEY).getAsString().toUpperCase()); }
public JsonSchema(JsonArray jsonArray) { JsonObject jsonObject = new JsonObject(); JsonObject dataType = new JsonObject(); jsonObject.addProperty(COLUMN_NAME_KEY, DEFAULT_RECORD_COLUMN_NAME); dataType.addProperty(TYPE_KEY, RECORD.toString()); dataType.add(RECORD_FIELDS_KEY, jsonArray); jsonObject.add(DATA_TYPE_KEY, dataType); setJsonSchemaProperties(jsonObject); this.type = RECORD; }
/** * {@link InputType} of the elements composed within complex type. * @param itemKey * @return */ public InputType getElementTypeUsingKey(String itemKey) { String type = this.getDataType().get(itemKey).getAsString().toUpperCase(); return InputType.valueOf(type); }
/** * Get symbols for a {@link InputType#ENUM} type. * @return */ public JsonArray getSymbols() { if (this.type.equals(ENUM)) { return getDataType().get(ENUM_SYMBOLS_KEY).getAsJsonArray(); } return new JsonArray(); }
/** * Get source.schema within a {@link InputType#RECORD} type. * The source.schema is represented by a {@link JsonArray} * @return */ public JsonArray getDataTypeValues() { if (this.type.equals(RECORD)) { return getDataType().get(RECORD_FIELDS_KEY).getAsJsonArray(); } return new JsonArray(); }
public JsonSchema(JsonArray jsonArray) { JsonObject jsonObject = new JsonObject(); JsonObject dataType = new JsonObject(); jsonObject.addProperty(COLUMN_NAME_KEY, DEFAULT_RECORD_COLUMN_NAME); dataType.addProperty(TYPE_KEY, RECORD.toString()); dataType.add(RECORD_FIELDS_KEY, jsonArray); jsonObject.add(DATA_TYPE_KEY, dataType); setJsonSchemaProperties(jsonObject); this.type = RECORD; }
/** * {@link InputType} of the elements composed within complex type. * @param itemKey * @return */ public InputType getElementTypeUsingKey(String itemKey) { String type = this.getDataType().get(itemKey).getAsString().toUpperCase(); return InputType.valueOf(type); }
/** * Get source.schema within a {@link InputType#RECORD} type. * The source.schema is represented by a {@link JsonArray} * @return */ public JsonArray getDataTypeValues() { if (this.type.equals(RECORD)) { return getDataType().get(RECORD_FIELDS_KEY).getAsJsonArray(); } return new JsonArray(); }