summaryrefslogtreecommitdiff
path: root/ddl/out/java/LambdaCube/TypeInfo/JSON.java
diff options
context:
space:
mode:
Diffstat (limited to 'ddl/out/java/LambdaCube/TypeInfo/JSON.java')
-rw-r--r--ddl/out/java/LambdaCube/TypeInfo/JSON.java86
1 files changed, 85 insertions, 1 deletions
diff --git a/ddl/out/java/LambdaCube/TypeInfo/JSON.java b/ddl/out/java/LambdaCube/TypeInfo/JSON.java
index d4ea991..6679e5d 100644
--- a/ddl/out/java/LambdaCube/TypeInfo/JSON.java
+++ b/ddl/out/java/LambdaCube/TypeInfo/JSON.java
@@ -1,11 +1,12 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-03-21T14:06:55.479415000000Z 2// 2016-03-21T15:32:17.924228000000Z
3 3
4package LambdaCube.TypeInfo; 4package LambdaCube.TypeInfo;
5 5
6import java.util.ArrayList; 6import java.util.ArrayList;
7import java.util.HashMap; 7import java.util.HashMap;
8import java.util.Iterator; 8import java.util.Iterator;
9import java.util.Map;
9import org.json.*; 10import org.json.*;
10import RT.*; 11import RT.*;
11 12
@@ -98,4 +99,87 @@ public class JSON {
98 } 99 }
99 throw new Exception("unknown type"); 100 throw new Exception("unknown type");
100 } 101 }
102
103 public static Object toJSON(Type type, Object rawObj) throws JSONException, Exception {
104 switch (type) {
105 case Range: {
106 Range v = (Range)rawObj;
107 JSONObject obj = new JSONObject();
108 switch (v.tag) {
109 case Range:
110 obj.put("tag", "Range");
111 {
112 Range.Range_ tv = (Range.Range_)v;
113 obj.put("startLine", toJSON(Type.Int,tv.startLine));
114 obj.put("startColumn", toJSON(Type.Int,tv.startColumn));
115 obj.put("endLine", toJSON(Type.Int,tv.endLine));
116 obj.put("endColumn", toJSON(Type.Int,tv.endColumn));
117 }
118 break;
119 }
120 return obj;
121 }
122 case TypeInfo: {
123 TypeInfo v = (TypeInfo)rawObj;
124 JSONObject obj = new JSONObject();
125 switch (v.tag) {
126 case TypeInfo:
127 obj.put("tag", "TypeInfo");
128 {
129 TypeInfo.TypeInfo_ tv = (TypeInfo.TypeInfo_)v;
130 obj.put("range", toJSON(Type.Range,tv.range));
131 obj.put("text", toJSON(Type.String,tv.text));
132 }
133 break;
134 }
135 return obj;
136 }
137 case CompileResult: {
138 CompileResult v = (CompileResult)rawObj;
139 JSONObject obj = new JSONObject();
140 switch (v.tag) {
141 case CompileError:
142 obj.put("tag", "CompileError");
143 {
144 CompileResult.CompileError_ tv = (CompileResult.CompileError_)v;
145 obj.put("arg0", toJSON(Type.Array_Range,tv._0));
146 obj.put("arg1", toJSON(Type.String,tv._1));
147 obj.put("arg2", toJSON(Type.Array_TypeInfo,tv._2));
148 }
149 break;
150 case Compiled:
151 obj.put("tag", "Compiled");
152 {
153 CompileResult.Compiled_ tv = (CompileResult.Compiled_)v;
154 obj.put("arg0", toJSON(Type.String,tv._0));
155 obj.put("arg1", toJSON(Type.String,tv._1));
156 obj.put("arg2", toJSON(Type.Pipeline,tv._2));
157 obj.put("arg3", toJSON(Type.Array_TypeInfo,tv._3));
158 }
159 break;
160 }
161 return obj;
162 }
163
164 case Int: { return rawObj; }
165 case String: { return rawObj; }
166 case Array_Range: {
167 ArrayList<Range> v = (ArrayList<Range>)rawObj;
168 JSONArray obj = new JSONArray();
169 for(Range i : v) {
170 obj.put(toJSON(Type.Range,i));
171 }
172 return obj;
173 }
174 case Array_TypeInfo: {
175 ArrayList<TypeInfo> v = (ArrayList<TypeInfo>)rawObj;
176 JSONArray obj = new JSONArray();
177 for(TypeInfo i : v) {
178 obj.put(toJSON(Type.TypeInfo,i));
179 }
180 return obj;
181 }
182 }
183 return null;
184 }
101} \ No newline at end of file 185} \ No newline at end of file