Search in sources :

Example 1 with DefaultFlowletSpecification

use of co.cask.cdap.internal.flowlet.DefaultFlowletSpecification in project cdap by caskdata.

the class FlowletSpecificationCodec method deserialize.

@Override
public FlowletSpecification deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObj = json.getAsJsonObject();
    String className = jsonObj.get("className").getAsString();
    String name = jsonObj.get("name").getAsString();
    String description = jsonObj.get("description").getAsString();
    FailurePolicy policy = FailurePolicy.valueOf(jsonObj.get("failurePolicy").getAsString());
    Set<String> dataSets = deserializeSet(jsonObj.get("datasets"), context, String.class);
    Map<String, String> properties = deserializeMap(jsonObj.get("properties"), context, String.class);
    Resources resources = context.deserialize(jsonObj.get("resources"), Resources.class);
    return new DefaultFlowletSpecification(className, name, description, policy, dataSets, properties, resources);
}
Also used : JsonObject(com.google.gson.JsonObject) DefaultFlowletSpecification(co.cask.cdap.internal.flowlet.DefaultFlowletSpecification) Resources(co.cask.cdap.api.Resources) FailurePolicy(co.cask.cdap.api.flow.flowlet.FailurePolicy)

Aggregations

Resources (co.cask.cdap.api.Resources)1 FailurePolicy (co.cask.cdap.api.flow.flowlet.FailurePolicy)1 DefaultFlowletSpecification (co.cask.cdap.internal.flowlet.DefaultFlowletSpecification)1 JsonObject (com.google.gson.JsonObject)1