1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.protocols.jsoncore; 17 18 import java.util.List; 19 import java.util.Map; 20 import software.amazon.awssdk.annotations.SdkProtectedApi; 21 22 /** 23 * Converter from a {@link JsonNode} to a new type. This is usually invoked via {@link JsonNode#visit(JsonNodeVisitor)}. 24 */ 25 @SdkProtectedApi 26 public interface JsonNodeVisitor<T> { 27 /** 28 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on a null JSON node. 29 */ visitNull()30 T visitNull(); 31 32 /** 33 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on a boolean JSON node. 34 */ visitBoolean(boolean bool)35 T visitBoolean(boolean bool); 36 37 /** 38 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on a number JSON node. 39 */ visitNumber(String number)40 T visitNumber(String number); 41 42 /** 43 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on a string JSON node. 44 */ visitString(String string)45 T visitString(String string); 46 47 /** 48 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on an array JSON node. 49 */ visitArray(List<JsonNode> array)50 T visitArray(List<JsonNode> array); 51 52 /** 53 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on an object JSON node. 54 */ visitObject(Map<String, JsonNode> object)55 T visitObject(Map<String, JsonNode> object); 56 57 /** 58 * Invoked if {@link JsonNode#visit(JsonNodeVisitor)} is invoked on an embedded object JSON node. 59 */ visitEmbeddedObject(Object embeddedObject)60 T visitEmbeddedObject(Object embeddedObject); 61 } 62