blob: 64e6ad0fcd8d60429adedab73029978ab488c916 [file] [log] [blame]
Sithara Punnassery589fac22016-10-03 11:51:53 -07001/*
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.incubator.elasticcfg;
17
18import java.util.List;
19
20/**
21 * Abstraction of an instance in the elastic config store.
22 */
23public interface ConfigNode<V> {
24 /**
25 * Builder for ConfigNode.
26 */
27 interface Builder<V> {
28 /**
29 * Adds the type of the instance node.
30 *
31 * @param type node type
32 * @return a ConfigNode builder
33 */
34 Builder addType(NodeType type);
35
36 /**
37 * Adds the value of the instance node.
38 *
39 * @param value at the node
40 * @return a ConfigNode builder
41 */
42 Builder addValue(Class<V> value);
43
44 /**
45 * Adds children to the children field.
46 *
47 * @param children to be added
48 * @return a ConfigNode builder
49 */
50 Builder addChildren(Class<ConfigNode> children);
51
52 /**
53 * Builds an immutable ConfigNode entity.
54 *
55 * @return ConfigNode
56 */
57 ConfigNode build();
58 }
59
60 /**
61 * Returns the type of the instance node.
62 *
63 * @return node type
64 */
65 NodeType type();
66
67 /**
68 * Returns the value of the instance node.
69 *
70 * @return value at the node
71 */
72 Class<V> value();
73
74 /**
75 * Returns the children of the instance node.
76 *
77 * @return children of the node
78 */
79 List<ConfigNode> children();
80}