@@ -40,8 +40,10 @@ public class DimensionSet {
40
40
* @param v1 Value of the single dimension
41
41
* @return a DimensionSet from the parameters
42
42
* @throws InvalidDimensionException if the dimension name or value is invalid
43
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
43
44
*/
44
- public static DimensionSet of (String d1 , String v1 ) throws InvalidDimensionException {
45
+ public static DimensionSet of (String d1 , String v1 )
46
+ throws InvalidDimensionException , DimensionSetExceededException {
45
47
return fromEntries (entryOf (d1 , v1 ));
46
48
}
47
49
@@ -54,9 +56,10 @@ public static DimensionSet of(String d1, String v1) throws InvalidDimensionExcep
54
56
* @param v2 Value of the second dimension
55
57
* @return a DimensionSet from the parameters
56
58
* @throws InvalidDimensionException if the dimension name or value is invalid
59
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
57
60
*/
58
61
public static DimensionSet of (String d1 , String v1 , String d2 , String v2 )
59
- throws InvalidDimensionException {
62
+ throws InvalidDimensionException , DimensionSetExceededException {
60
63
return fromEntries (entryOf (d1 , v1 ), entryOf (d2 , v2 ));
61
64
}
62
65
@@ -71,9 +74,10 @@ public static DimensionSet of(String d1, String v1, String d2, String v2)
71
74
* @param v3 Value of the third dimension
72
75
* @return a DimensionSet from the parameters
73
76
* @throws InvalidDimensionException if the dimension name or value is invalid
77
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
74
78
*/
75
79
public static DimensionSet of (String d1 , String v1 , String d2 , String v2 , String d3 , String v3 )
76
- throws InvalidDimensionException {
80
+ throws InvalidDimensionException , DimensionSetExceededException {
77
81
return fromEntries (entryOf (d1 , v1 ), entryOf (d2 , v2 ), entryOf (d3 , v3 ));
78
82
}
79
83
@@ -90,10 +94,11 @@ public static DimensionSet of(String d1, String v1, String d2, String v2, String
90
94
* @param v4 Value of the fourth dimension
91
95
* @return a DimensionSet from the parameters
92
96
* @throws InvalidDimensionException if the dimension name or value is invalid
97
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
93
98
*/
94
99
public static DimensionSet of (
95
100
String d1 , String v1 , String d2 , String v2 , String d3 , String v3 , String d4 , String v4 )
96
- throws InvalidDimensionException {
101
+ throws InvalidDimensionException , DimensionSetExceededException {
97
102
98
103
return fromEntries (entryOf (d1 , v1 ), entryOf (d2 , v2 ), entryOf (d3 , v3 ), entryOf (d4 , v4 ));
99
104
}
@@ -113,6 +118,7 @@ public static DimensionSet of(
113
118
* @param v5 Value of the fifth dimension
114
119
* @return a DimensionSet from the parameters
115
120
* @throws InvalidDimensionException if the dimension name or value is invalid
121
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
116
122
*/
117
123
public static DimensionSet of (
118
124
String d1 ,
@@ -125,7 +131,7 @@ public static DimensionSet of(
125
131
String v4 ,
126
132
String d5 ,
127
133
String v5 )
128
- throws InvalidDimensionException {
134
+ throws InvalidDimensionException , DimensionSetExceededException {
129
135
130
136
return fromEntries (
131
137
entryOf (d1 , v1 ),
@@ -136,7 +142,7 @@ public static DimensionSet of(
136
142
}
137
143
138
144
private static DimensionSet fromEntries (DimensionEntry ... entries )
139
- throws InvalidDimensionException {
145
+ throws InvalidDimensionException , DimensionSetExceededException {
140
146
DimensionSet ds = new DimensionSet ();
141
147
for (DimensionEntry entry : entries ) {
142
148
ds .addDimension (entry .key , entry .value );
@@ -154,8 +160,10 @@ private static DimensionEntry entryOf(String key, String value) {
154
160
* @param dimension Name of the dimension
155
161
* @param value Value of the dimension
156
162
* @throws InvalidDimensionException if the dimension name or value is invalid
163
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
157
164
*/
158
- public void addDimension (String dimension , String value ) throws InvalidDimensionException {
165
+ public void addDimension (String dimension , String value )
166
+ throws InvalidDimensionException , DimensionSetExceededException {
159
167
Validator .validateDimensionSet (dimension , value );
160
168
161
169
if (this .getDimensionKeys ().size () >= Constants .MAX_DIMENSION_SET_SIZE ) {
@@ -171,8 +179,9 @@ public void addDimension(String dimension, String value) throws InvalidDimension
171
179
*
172
180
* @param other Other dimension sets to merge with current
173
181
* @return a new DimensionSet from combining the current DimensionSet with other
182
+ * @throws DimensionSetExceededException if the number of dimensions exceeds the limit
174
183
*/
175
- public DimensionSet add (DimensionSet other ) {
184
+ public DimensionSet add (DimensionSet other ) throws DimensionSetExceededException {
176
185
DimensionSet mergedDimensionSet = new DimensionSet ();
177
186
int mergedDimensionSetSize =
178
187
this .getDimensionKeys ().size () + other .dimensionRecords .keySet ().size ();
0 commit comments