@Override public WorkflowTokenNodeDetail deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { Map<String, String> tokenDataAtNode = deserializeMap(json, context, String.class); return new WorkflowTokenNodeDetail(tokenDataAtNode); } }
public static GsonBuilder addTypeAdapters(GsonBuilder builder) { return builder .registerTypeAdapter(Schema.class, new SchemaTypeAdapter()) .registerTypeAdapter(ApplicationSpecification.class, new ApplicationSpecificationCodec()) .registerTypeAdapter(FlowSpecification.class, new FlowSpecificationCodec()) .registerTypeAdapter(FlowletSpecification.class, new FlowletSpecificationCodec()) .registerTypeAdapter(MapReduceSpecification.class, new MapReduceSpecificationCodec()) .registerTypeAdapter(SparkSpecification.class, new SparkSpecificationCodec()) .registerTypeAdapter(WorkflowSpecification.class, new WorkflowSpecificationCodec()) .registerTypeAdapter(WorkflowNode.class, new WorkflowNodeCodec()) .registerTypeAdapter(CustomActionSpecification.class, new CustomActionSpecificationCodec()) .registerTypeAdapter(ConditionSpecification.class, new ConditionSpecificationCodec()) .registerTypeAdapter(ServiceSpecification.class, new ServiceSpecificationCodec()) .registerTypeAdapter(WorkerSpecification.class, new WorkerSpecificationCodec()) .registerTypeAdapter(BasicThrowable.class, new BasicThrowableCodec()) .registerTypeAdapter(Trigger.class, new TriggerCodec()) .registerTypeAdapter(SatisfiableTrigger.class, new TriggerCodec()) .registerTypeAdapter(Constraint.class, new ConstraintCodec()) .registerTypeAdapterFactory(new AppSpecTypeAdapterFactory()); }
@Override public ConditionSpecification 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(); Set<String> datasets = deserializeSet(jsonObj.get("datasets"), context, String.class); Map<String, String> properties = deserializeMap(jsonObj.get("properties"), context, String.class); return new DefaultConditionSpecification(className, name, description, properties, datasets); }
private WorkflowId deserializeWorkflowId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new WorkflowId(program.getParent(), program.getProgram()); }
private ServiceId deserializeServiceId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new ServiceId(program.getParent(), program.getProgram()); }
protected final <V> JsonElement serializeMap(Map<String, V> map, JsonSerializationContext context, Class<V> valueType) { Type type = new TypeToken<Map<String, V>>() { }.where(new TypeParameter<V>() { }, valueType).getType(); return context.serialize(map, type); }
protected final <V> JsonElement serializeList(List<V> list, JsonSerializationContext context, Class<V> valueType) { Type type = new TypeToken<List<V>>() { }.where(new TypeParameter<V>() { }, valueType).getType(); return context.serialize(list, type); }
protected final <V> JsonElement serializeSet(Set<V> set, JsonSerializationContext context, Class<V> valueType) { Type type = new TypeToken<Set<V>>() { }.where(new TypeParameter<V>() { }, valueType).getType(); return context.serialize(set, type); }
public static GsonBuilder addTypeAdapters(GsonBuilder builder) { return builder .registerTypeAdapter(Schema.class, new SchemaTypeAdapter()) .registerTypeAdapter(ApplicationSpecification.class, new ApplicationSpecificationCodec()) .registerTypeAdapter(MapReduceSpecification.class, new MapReduceSpecificationCodec()) .registerTypeAdapter(SparkSpecification.class, new SparkSpecificationCodec()) .registerTypeAdapter(WorkflowSpecification.class, new WorkflowSpecificationCodec()) .registerTypeAdapter(WorkflowNode.class, new WorkflowNodeCodec()) .registerTypeAdapter(CustomActionSpecification.class, new CustomActionSpecificationCodec()) .registerTypeAdapter(ConditionSpecification.class, new ConditionSpecificationCodec()) .registerTypeAdapter(ServiceSpecification.class, new ServiceSpecificationCodec()) .registerTypeAdapter(WorkerSpecification.class, new WorkerSpecificationCodec()) .registerTypeAdapter(BasicThrowable.class, new BasicThrowableCodec()) .registerTypeAdapter(Trigger.class, new TriggerCodec()) .registerTypeAdapter(SatisfiableTrigger.class, new TriggerCodec()) .registerTypeAdapter(Constraint.class, new ConstraintCodec()) .registerTypeAdapterFactory(new AppSpecTypeAdapterFactory()); }
private WorkerId deserializeWorkerId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new WorkerId(program.getParent(), program.getProgram()); }
private WorkflowId deserializeWorkflowId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new WorkflowId(program.getParent(), program.getProgram()); }
@Override public WorkflowTokenNodeDetail deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { Map<String, String> tokenDataAtNode = deserializeMap(json, context, String.class); return new WorkflowTokenNodeDetail(tokenDataAtNode); } }
protected final <V> JsonElement serializeMap(Map<String, V> map, JsonSerializationContext context, Class<V> valueType) { Type type = new TypeToken<Map<String, V>>() { }.where(new TypeParameter<V>() { }, valueType).getType(); return context.serialize(map, type); }
protected final <V> JsonElement serializeList(List<V> list, JsonSerializationContext context, Class<V> valueType) { Type type = new TypeToken<List<V>>() { }.where(new TypeParameter<V>() { }, valueType).getType(); return context.serialize(list, type); }
protected final <V> JsonElement serializeSet(Set<V> set, JsonSerializationContext context, Class<V> valueType) { Type type = new TypeToken<Set<V>>() { }.where(new TypeParameter<V>() { }, valueType).getType(); return context.serialize(set, type); }
private WorkerId deserializeWorkerId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new WorkerId(program.getParent(), program.getProgram()); }
private WorkerId deserializeWorkerId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new WorkerId(program.getParent(), program.getProgram()); }
private ServiceId deserializeServiceId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new ServiceId(program.getParent(), program.getProgram()); }
private ServiceId deserializeServiceId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new ServiceId(program.getParent(), program.getProgram()); }
private WorkflowId deserializeWorkflowId(JsonObject id) { ProgramId program = deserializeProgramId(id); return new WorkflowId(program.getParent(), program.getProgram()); }