@Test public void testJson2() { Expr expr = new BinaryOperator(OpType.LessThan, new LiteralValue("1", LiteralType.Unsigned_Integer), new LiteralValue("2", LiteralType.Unsigned_Integer)); Relation relation = new Relation("employee"); Selection selection = new Selection(expr); selection.setChild(relation); Aggregation aggregation = new Aggregation(); aggregation.setTargets(new NamedExpr[]{ new NamedExpr(new ColumnReferenceExpr("col1")) } ); aggregation.setChild(selection); Sort.SortSpec spec = new Sort.SortSpec(new ColumnReferenceExpr("col2")); Sort sort = new Sort(new Sort.SortSpec[]{spec}); sort.setChild(aggregation); String json = sort.toJson(); Expr fromJson = JsonHelper.fromJson(json, Expr.class); assertEquals(sort, fromJson); }
public String toJson() { return JsonHelper.toJson(this); }
Expr implements JsonSerializable, Cloneable { public String toJson() { return JsonHelper.toJson(this); } }
Expr implements JsonSerializable, Cloneable { public String toJson() { return JsonHelper.toJson(this); } Expr(OpType opType); }
Expr implements JsonSerializable, Cloneable { public String toJson() { return JsonHelper.toJson(this); } Expr(OpType opType); OpType getType(); @Override abstract int hashCode(); @Override boolean equals(Object obj); @Override Object clone(); @Override String toString(); String toJson(); void accept(ExprVisitor visitor); }
Expr implements JsonSerializable, Cloneable { public String toJson() { return JsonHelper.toJson(this); } Expr(OpType opType); OpType getType(); @Override abstract int hashCode(); @Override boolean equals(Object obj); @Override Object clone(); @Override String toString(); String toJson(); void accept(ExprVisitor visitor);  }