File tree 1 file changed +26
-0
lines changed
smithy-model/src/main/java/software/amazon/smithy/model/shapes
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -199,4 +199,30 @@ public R timestampShape(TimestampShape shape) {
199
199
return getDefault (shape );
200
200
}
201
201
}
202
+
203
+ /**
204
+ * Creates {@link ShapeVisitor} that only requires implementation of
205
+ * all data shape branches, but does not support service shapes.
206
+ *
207
+ * @param <R> Return type.
208
+ */
209
+ abstract class DataShapeVisitor <R > implements ShapeVisitor <R > {
210
+ @ Override
211
+ public R operationShape (OperationShape shape ) {
212
+ throw new IllegalArgumentException ("DataShapeVisitor cannot be use to visit "
213
+ + "Operation Shapes. Attempted to visit: " + shape );
214
+ }
215
+
216
+ @ Override
217
+ public R resourceShape (ResourceShape shape ) {
218
+ throw new IllegalArgumentException ("DataShapeVisitor cannot be use to visit "
219
+ + "Resource Shapes. Attempted to visit: " + shape );
220
+ }
221
+
222
+ @ Override
223
+ public R serviceShape (ServiceShape shape ) {
224
+ throw new IllegalArgumentException ("DataShapeVisitor cannot be use to visit "
225
+ + "Service Shapes. Attempted to visit: " + shape );
226
+ }
227
+ }
202
228
}
You can’t perform that action at this time.
0 commit comments