1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5  * the License. A copy of the License is located at
6  *
7  * http://aws.amazon.com/apache2.0
8  *
9  * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11  * and limitations under the License.
12  */
13 
14 package software.amazon.awssdk.services.kms.endpoints.internal;
15 
16 import software.amazon.awssdk.annotations.SdkInternalApi;
17 
18 @SdkInternalApi
19 public interface ExprVisitor<R> {
20 
visitLiteral(Literal literal)21     R visitLiteral(Literal literal);
22 
visitRef(Ref ref)23     R visitRef(Ref ref);
24 
visitFn(Fn fn)25     R visitFn(Fn fn);
26 
27     abstract class Default<R> implements ExprVisitor<R> {
28 
getDefault()29         public abstract R getDefault();
30 
31         @Override
visitLiteral(Literal literal)32         public R visitLiteral(Literal literal) {
33             return getDefault();
34         }
35 
36         @Override
visitRef(Ref ref)37         public R visitRef(Ref ref) {
38             return getDefault();
39         }
40 
41         @Override
visitFn(Fn fn)42         public R visitFn(Fn fn) {
43             return getDefault();
44         }
45     }
46 }
47