2
2
3
3
import com .relogiclabs .json .schema .internal .antlr .JsonParser ;
4
4
import com .relogiclabs .json .schema .internal .antlr .JsonParserBaseVisitor ;
5
+ import com .relogiclabs .json .schema .internal .builder .JArrayBuilder ;
6
+ import com .relogiclabs .json .schema .internal .builder .JBooleanBuilder ;
7
+ import com .relogiclabs .json .schema .internal .builder .JDoubleBuilder ;
8
+ import com .relogiclabs .json .schema .internal .builder .JFloatBuilder ;
9
+ import com .relogiclabs .json .schema .internal .builder .JIntegerBuilder ;
10
+ import com .relogiclabs .json .schema .internal .builder .JNullBuilder ;
11
+ import com .relogiclabs .json .schema .internal .builder .JObjectBuilder ;
12
+ import com .relogiclabs .json .schema .internal .builder .JPropertyBuilder ;
13
+ import com .relogiclabs .json .schema .internal .builder .JRootBuilder ;
14
+ import com .relogiclabs .json .schema .internal .builder .JStringBuilder ;
5
15
import com .relogiclabs .json .schema .tree .Context ;
6
16
import com .relogiclabs .json .schema .tree .RuntimeContext ;
7
- import com .relogiclabs .json .schema .types .JArray ;
8
- import com .relogiclabs .json .schema .types .JBoolean ;
9
- import com .relogiclabs .json .schema .types .JDouble ;
10
- import com .relogiclabs .json .schema .types .JFloat ;
11
- import com .relogiclabs .json .schema .types .JInteger ;
12
- import com .relogiclabs .json .schema .types .JNode ;
13
- import com .relogiclabs .json .schema .types .JNull ;
14
- import com .relogiclabs .json .schema .types .JObject ;
15
- import com .relogiclabs .json .schema .types .JProperty ;
16
- import com .relogiclabs .json .schema .types .JRoot ;
17
- import com .relogiclabs .json .schema .types .JString ;
17
+ import com .relogiclabs .json .schema .type .JNode ;
18
+ import com .relogiclabs .json .schema .type .JProperty ;
18
19
19
20
import java .util .HashMap ;
20
21
import java .util .Map ;
@@ -35,7 +36,7 @@ public JsonTreeVisitor(RuntimeContext runtime) {
35
36
36
37
@ Override
37
38
public JNode visitJson (JsonParser .JsonContext ctx ) {
38
- return new JRoot . Builder ()
39
+ return new JRootBuilder ()
39
40
.relations (relations )
40
41
.context (new Context (ctx , runtime ))
41
42
.value (visit (ctx .value ()))
@@ -52,7 +53,7 @@ public JNode visitValue(JsonParser.ValueContext ctx) {
52
53
53
54
@ Override
54
55
public JNode visitObject (JsonParser .ObjectContext ctx ) {
55
- return new JObject . Builder ()
56
+ return new JObjectBuilder ()
56
57
.relations (relations )
57
58
.context (new Context (ctx , runtime ))
58
59
.properties (checkForDuplicate (ctx .property ().stream ()
@@ -62,7 +63,7 @@ public JNode visitObject(JsonParser.ObjectContext ctx) {
62
63
63
64
@ Override
64
65
public JNode visitProperty (JsonParser .PropertyContext ctx ) {
65
- return new JProperty . Builder ()
66
+ return new JPropertyBuilder ()
66
67
.relations (relations )
67
68
.context (new Context (ctx , runtime ))
68
69
.key (unquote (ctx .STRING ().getText ()))
@@ -72,7 +73,7 @@ public JNode visitProperty(JsonParser.PropertyContext ctx) {
72
73
73
74
@ Override
74
75
public JNode visitArray (JsonParser .ArrayContext ctx ) {
75
- return new JArray . Builder ()
76
+ return new JArrayBuilder ()
76
77
.relations (relations )
77
78
.context (new Context (ctx , runtime ))
78
79
.elements (ctx .value ().stream ().map (this ::visit ).toList ())
@@ -81,23 +82,23 @@ public JNode visitArray(JsonParser.ArrayContext ctx) {
81
82
82
83
@ Override
83
84
public JNode visitPrimitiveTrue (JsonParser .PrimitiveTrueContext ctx ) {
84
- return new JBoolean . Builder ()
85
+ return new JBooleanBuilder ()
85
86
.relations (relations )
86
87
.context (new Context (ctx , runtime ))
87
88
.value (true ).build ();
88
89
}
89
90
90
91
@ Override
91
92
public JNode visitPrimitiveFalse (JsonParser .PrimitiveFalseContext ctx ) {
92
- return new JBoolean . Builder ()
93
+ return new JBooleanBuilder ()
93
94
.relations (relations )
94
95
.context (new Context (ctx , runtime ))
95
96
.value (false ).build ();
96
97
}
97
98
98
99
@ Override
99
100
public JNode visitPrimitiveString (JsonParser .PrimitiveStringContext ctx ) {
100
- return new JString . Builder ()
101
+ return new JStringBuilder ()
101
102
.relations (relations )
102
103
.context (new Context (ctx , runtime ))
103
104
.value (toEncoded (ctx .STRING ().getText ()))
@@ -106,7 +107,7 @@ public JNode visitPrimitiveString(JsonParser.PrimitiveStringContext ctx) {
106
107
107
108
@ Override
108
109
public JNode visitPrimitiveInteger (JsonParser .PrimitiveIntegerContext ctx ) {
109
- return new JInteger . Builder ()
110
+ return new JIntegerBuilder ()
110
111
.relations (relations )
111
112
.context (new Context (ctx , runtime ))
112
113
.value (Long .valueOf (ctx .INTEGER ().getText ()))
@@ -115,7 +116,7 @@ public JNode visitPrimitiveInteger(JsonParser.PrimitiveIntegerContext ctx) {
115
116
116
117
@ Override
117
118
public JNode visitPrimitiveFloat (JsonParser .PrimitiveFloatContext ctx ) {
118
- return new JFloat . Builder ()
119
+ return new JFloatBuilder ()
119
120
.relations (relations )
120
121
.context (new Context (ctx , runtime ))
121
122
.value (Double .valueOf (ctx .FLOAT ().getText ()))
@@ -124,7 +125,7 @@ public JNode visitPrimitiveFloat(JsonParser.PrimitiveFloatContext ctx) {
124
125
125
126
@ Override
126
127
public JNode visitPrimitiveDouble (JsonParser .PrimitiveDoubleContext ctx ) {
127
- return new JDouble . Builder ()
128
+ return new JDoubleBuilder ()
128
129
.relations (relations )
129
130
.context (new Context (ctx , runtime ))
130
131
.value (Double .valueOf (ctx .DOUBLE ().getText ()))
@@ -133,7 +134,7 @@ public JNode visitPrimitiveDouble(JsonParser.PrimitiveDoubleContext ctx) {
133
134
134
135
@ Override
135
136
public JNode visitPrimitiveNull (JsonParser .PrimitiveNullContext ctx ) {
136
- return new JNull . Builder ()
137
+ return new JNullBuilder ()
137
138
.relations (relations )
138
139
.context (new Context (ctx , runtime ))
139
140
.build ();
0 commit comments