2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
 
  24  * Abstraction of properties node data tree. This intermediate representation
 
  25  * will enable data format serializers to be agnostic of DG context memory
 
  26  * nuances and thereby will enable faster development of new data faormat
 
  29 public abstract class PropertiesNode {
 
  32     private String namespace;
 
  34     private PropertiesNode parent;
 
  37      * Creates an instance of properties node.
 
  39     protected PropertiesNode() {
 
  43      * Creates an instance of properties node.
 
  45      * @param name name of node
 
  46      * @param namespace namespace of node, null indicates parent namespace
 
  47      * @param uri URI of this node, if null its calculated based on parent and
 
  48      * current value of name and namespace
 
  49      * @param parent parent's node
 
  51     protected PropertiesNode(String name, String namespace, String uri, PropertiesNode parent) {
 
  53         this.namespace = namespace;
 
  59      * Adds a child to a current node.
 
  61      * @param name name of child
 
  62      * @param namespace namespace of child, null represents parent namespace
 
  63      * @param type type of node
 
  64      * @return added properties node
 
  66     public abstract PropertiesNode addChild(String name, String namespace, NodeType type);
 
  69      * Adds a child with value to a current node.
 
  71      * @param name name of child
 
  72      * @param namespace namespace of child, null represents parent namespace
 
  73      * @param type type of node
 
  74      * @param value value of node
 
  75      * @return added properties node
 
  77     public abstract PropertiesNode addChild(String name, String namespace, NodeType type, String value);
 
  80      * Adds a child at a given index to a current node. To be used in case of
 
  81      * leaf holder child's which is multi instance node.
 
  83      * @param index index at which node is to be added
 
  84      * @param name name of child
 
  85      * @param namespace namespace of child, null represents parent namespace
 
  86      * @param type type of node
 
  87      * @return added properties node
 
  89     public abstract PropertiesNode addChild(String index, String name, String namespace, NodeType type);
 
  91     public void name(String name) {
 
  95     public void namespace(String namespace) {
 
  96         this.namespace = namespace;
 
  99     public void uri(String uri) {
 
 103     public void parent(PropertiesNode parent) {
 
 104         this.parent = parent;
 
 107     public PropertiesNode parent() {
 
 111     public String name() {
 
 115     public String namespace() {
 
 119     public String uri() {