Search in sources :

Example 1 with OperationType

use of io.cdap.cdap.api.lineage.field.OperationType in project cdap by caskdata.

the class OperationTypeAdapter method deserialize.

@Override
public Operation deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObj = json.getAsJsonObject();
    OperationType type = context.deserialize(jsonObj.get("type"), OperationType.class);
    switch(type) {
        case READ:
            return context.deserialize(json, ReadOperation.class);
        case TRANSFORM:
            return context.deserialize(json, TransformOperation.class);
        case WRITE:
            return context.deserialize(json, WriteOperation.class);
    }
    return null;
}
Also used : JsonObject(com.google.gson.JsonObject) OperationType(io.cdap.cdap.api.lineage.field.OperationType)

Aggregations

JsonObject (com.google.gson.JsonObject)1 OperationType (io.cdap.cdap.api.lineage.field.OperationType)1