public TriggerDef toThrift() { TriggerDef td = new TriggerDef(); td.setName(name); td.setOptions(Collections.singletonMap(CLASS, classOption)); return td; }
public static Map<String, TriggerDefinition> fromThrift(List<TriggerDef> thriftDefs) { Map<String, TriggerDefinition> triggerDefinitions = new HashMap<>(); for (TriggerDef thriftDef : thriftDefs) triggerDefinitions.put(thriftDef.getName(), fromThrift(thriftDef)); return triggerDefinitions; }
public static List<TriggerDef> toThrift(Map<String, TriggerDefinition> triggers) { List<TriggerDef> thriftDefs = new ArrayList<>(triggers.size()); for (TriggerDefinition def : triggers.values()) thriftDefs.add(def.toThrift()); return thriftDefs; }
public static TriggerDefinition fromThrift(TriggerDef thriftDef) { return new TriggerDefinition(thriftDef.getName(), thriftDef.getOptions().get(CLASS)); }