@@ -14,20 +14,32 @@ public class DefaultReactorQLRecord implements ReactorQLRecord, Comparable<Defau
14
14
@ Getter
15
15
private ReactorQLContext context ;
16
16
17
- private final Map <String , Object > records = new ConcurrentHashMap <>( 32 ) ;
17
+ private final Map <String , Object > records ;
18
18
19
- private final Map <String , Object > results = new ConcurrentHashMap <>( 32 ) ;
19
+ private final Map <String , Object > results ;
20
20
21
21
private final static String THIS_RECORD = "this" ;
22
22
23
23
@ Getter
24
24
@ Setter
25
25
private String name ;
26
26
27
+ public DefaultReactorQLRecord (
28
+ String name ,
29
+ Map <String , Object > records ,
30
+ Map <String , Object > results ,
31
+ ReactorQLContext context ) {
32
+ this .name = name ;
33
+ this .records = records instanceof ConcurrentHashMap ? records : new ConcurrentHashMap <>(records );
34
+ this .results = results instanceof ConcurrentHashMap ? results : new ConcurrentHashMap <>(results );
35
+ this .context = context ;
36
+ }
37
+
27
38
public DefaultReactorQLRecord (
28
39
String name ,
29
40
Object thisRecord ,
30
41
ReactorQLContext context ) {
42
+ this ();
31
43
if (name != null ) {
32
44
records .put (name , thisRecord );
33
45
}
@@ -39,6 +51,8 @@ public DefaultReactorQLRecord(
39
51
}
40
52
41
53
private DefaultReactorQLRecord () {
54
+ records = new ConcurrentHashMap <>(32 );
55
+ results = new ConcurrentHashMap <>(32 );
42
56
}
43
57
44
58
@ Override
@@ -102,7 +116,7 @@ public ReactorQLRecord addRecords(Map<String, Object> records) {
102
116
@ Override
103
117
public Map <String , Object > getRecords (boolean all ) {
104
118
if (all ) {
105
- return Collections . unmodifiableMap ( records ) ;
119
+ return records ;
106
120
}
107
121
return Maps .filterKeys (records , (k ) -> !Objects .equals (THIS_RECORD , k ));
108
122
}
0 commit comments