blob: 7432dd3e7e398fbabcf37cc400db465f268922a4 [file] [log] [blame]
chengfanc58d4be2016-09-20 10:33:12 +08001/*
2 * Copyright 2016-present Open Networking Laboratory
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 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.protocol.restconf.server.utils.parser.api;
17
18
19import com.fasterxml.jackson.databind.JsonNode;
20
21/**
22 * Abstraction of an entity which provide call back methods which are called
23 * by JSON walker while walking the JSON data tree. This interface needs to be
24 * implemented by protocol implementing listener's based call backs while JSON
25 * walk.
26 */
27public interface JsonListener {
28
29 /**
30 * Callback invoked during a node entry.
31 * All the related information about the node can be obtain from the JSON
32 * object.
33 *
34 * @param fieldName the field name of the JSON Node value
35 * @param node the JsonNode which is walked through
36 */
37 void enterJsonNode(String fieldName, JsonNode node);
38
39 /**
40 * Callback invoked during a node exit.
41 * All the related information about the node can be obtain from the JSON
42 * node.
43 *
44 * @param jsonNode JSON node which has been walked through
45 */
46 void exitJsonNode(JsonNode jsonNode);
47
48}