27
27
/** A class representing a collection of statistic values. */
28
28
public class StatisticValues {
29
29
30
+ private StatisticValues () {}
31
+
32
+ /**
33
+ * Creates a statistic value that holds a boolean value.
34
+ *
35
+ * @param value the boolean value to be held by this statistic value
36
+ * @return a BooleanValue instance containing the provided boolean value
37
+ */
38
+ public static BooleanValue booleanValue (boolean value ) {
39
+ return new BooleanValue (value );
40
+ }
41
+
42
+ /**
43
+ * Creates a statistic value that holds a long value.
44
+ *
45
+ * @param value the long value to be held by this statistic value
46
+ * @return a LongValue instance containing the provided long value
47
+ */
48
+ public static LongValue longValue (long value ) {
49
+ return new LongValue (value );
50
+ }
51
+
52
+ /**
53
+ * Creates a statistic value that holds a double value.
54
+ *
55
+ * @param value the double value to be held by this statistic value
56
+ * @return a DoubleValue instance containing the provided double value
57
+ */
58
+ public static DoubleValue doubleValue (double value ) {
59
+ return new DoubleValue (value );
60
+ }
61
+
62
+ /**
63
+ * Creates a statistic value that holds a string value.
64
+ *
65
+ * @param value the string value to be held by this statistic value
66
+ * @return a StringValue instance containing the provided string value
67
+ */
68
+ public static StringValue stringValue (String value ) {
69
+ return new StringValue (value );
70
+ }
71
+
72
+ /**
73
+ * Creates a statistic value that holds a list of other statistic values.
74
+ *
75
+ * @param values the list of statistic values to be held by this statistic value
76
+ * @return a ListValue instance containing the provided list of statistic values
77
+ */
78
+ public static ListValue listValue (List <StatisticValue > values ) {
79
+ return new ListValue (values );
80
+ }
81
+
82
+ /**
83
+ * Creates a statistic value that holds a map of string keys to other statistic values.
84
+ *
85
+ * @param values the map of string keys to statistic values to be held by this statistic value
86
+ * @return an ObjectValue instance containing the provided map of statistic values
87
+ */
88
+ public static ObjectValue objectValue (Map <String , StatisticValue > values ) {
89
+ return new ObjectValue (values );
90
+ }
91
+
30
92
/** A statistic value that holds a Boolean value. */
31
93
public static class BooleanValue implements StatisticValue <Boolean > {
32
94
private final Boolean value ;
33
95
34
- public BooleanValue (Boolean value ) {
96
+ private BooleanValue (Boolean value ) {
35
97
this .value = value ;
36
98
}
37
99
@@ -50,7 +112,7 @@ public Type dataType() {
50
112
public static class LongValue implements StatisticValue <Long > {
51
113
private final Long value ;
52
114
53
- public LongValue (Long value ) {
115
+ private LongValue (Long value ) {
54
116
this .value = value ;
55
117
}
56
118
@@ -69,12 +131,7 @@ public Type dataType() {
69
131
public static class DoubleValue implements StatisticValue <Double > {
70
132
private final Double value ;
71
133
72
- /**
73
- * Creates a DoubleValue with the given double value.
74
- *
75
- * @param value The double value to be held by this statistic value.
76
- */
77
- public DoubleValue (Double value ) {
134
+ private DoubleValue (Double value ) {
78
135
this .value = value ;
79
136
}
80
137
@@ -93,12 +150,7 @@ public Type dataType() {
93
150
public static class StringValue implements StatisticValue <String > {
94
151
private final String value ;
95
152
96
- /**
97
- * Creates a StringValue with the given string value.
98
- *
99
- * @param value The string value to be held by this statistic value.
100
- */
101
- public StringValue (String value ) {
153
+ private StringValue (String value ) {
102
154
this .value = value ;
103
155
}
104
156
@@ -117,12 +169,7 @@ public Type dataType() {
117
169
public static class ListValue implements StatisticValue <List <StatisticValue >> {
118
170
private final List <StatisticValue > values ;
119
171
120
- /**
121
- * Creates a ListValue with the given list of statistic values.
122
- *
123
- * @param values A list of StatisticValue instances.
124
- */
125
- public ListValue (List <StatisticValue > values ) {
172
+ private ListValue (List <StatisticValue > values ) {
126
173
Preconditions .checkArgument (
127
174
values != null && values .isEmpty (), "Values cannot be null or empty" );
128
175
this .values = values ;
@@ -143,13 +190,7 @@ public Type dataType() {
143
190
public static class ObjectValue implements StatisticValue <Map <String , StatisticValue >> {
144
191
private final Map <String , StatisticValue > values ;
145
192
146
- /**
147
- * Creates an ObjectValue with the given map of statistic values.
148
- *
149
- * @param values A map where keys are String identifiers and values are StatisticValue
150
- * instances.
151
- */
152
- public ObjectValue (Map <String , StatisticValue > values ) {
193
+ private ObjectValue (Map <String , StatisticValue > values ) {
153
194
Preconditions .checkArgument (
154
195
values != null && !values .isEmpty (), "Values cannot be null or empty" );
155
196
this .values = values ;
0 commit comments