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;
26 * Abstraction of an entity to enable encoding and decoding of properties
27 * to an abstract properties node tree using YANG based schema.
28 * This serializer will be used by other data format serializers and will keep
29 * them abstract from properties nuances thereby enabling quick addition of any
30 * new data format serializer.
32 * @param <T> type of schema node
33 * @param <P> schema context of the model
35 public abstract class PropertiesNodeSerializer<T, P> {
38 * Schema node from which the property is made.
43 * Schema context of the model.
48 * URL pointing to the schema node.
53 * Creates the properties node serializer.
55 * @param schemaNode schema node.
56 * @param schemaCtx schema context
57 * @param uri URL of the request
59 public PropertiesNodeSerializer(T schemaNode, P schemaCtx, String uri) {
60 this.schemaNode = schemaNode;
61 this.schemaCtx = schemaCtx;
67 * Encodes from properties to properties-node tree.
69 * @param paramMap parameter map
70 * @return properties node
72 public abstract PropertiesNode encode(Map<String, String> paramMap);
75 * Decodes from properties-node to properties map.
77 * @param propertiesNode properties-node
78 * @return parameter map
80 public abstract Map<String, String> decode(PropertiesNode propertiesNode);
83 * Returns the schema node of the property
87 public T getSchemaNode(){
92 * Returns the schema context
96 public P getSchemaCtx() {
105 public String getUri() {