blob: 380d307d61741b26bff237289988ed21fc1922bd [file] [log] [blame]
Gaurav Agrawal2779d362017-02-17 16:10:22 +05301/*
Brian O'Connor72b2df22017-08-03 18:48:28 -07002 * Copyright 2017-present Open Networking Foundation
Gaurav Agrawal2779d362017-02-17 16:10:22 +05303 *
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 */
16
17package org.onosproject.yang.model;
18
19import java.util.LinkedList;
20import java.util.List;
21
22/**
23 * Representation of an entity that provides common basis to specify atomic
24 * model.
25 */
26public final class LeafModelObject extends ModelObject {
27
28 private LeafIdentifier leafIdentifier;
29 private List<Object> values;
30
31 /**
32 * Creates an instance of leaf model object.
33 */
34 public LeafModelObject() {
35 super(ModelObjectType.ATOMIC);
36 values = new LinkedList<>();
37 }
38
39 /**
40 * Returns leaf identifier.
41 *
42 * @return leaf identifier
43 */
44 public LeafIdentifier leafIdentifier() {
45 return leafIdentifier;
46 }
47
48 /**
49 * Sets leaf identifier.
50 *
51 * @param id leaf identifier
52 */
53 public void leafIdentifier(LeafIdentifier id) {
54 leafIdentifier = id;
55 }
56
57 /**
58 * Returns value of leaf, it will be single value for leaf and can be
59 * single or list for leaf-list.
60 *
61 * @return value(s)
62 */
63 public List<Object> values() {
64 return values;
65 }
66
67 /**
68 * Sets list of values. For leaf it will always be single value.
69 *
70 * @param v value(s)
71 */
72 public void values(List<Object> v) {
73 values = v;
74 }
Vidyashree Ramaa5ba6562017-03-08 11:23:28 +053075
76 /**
77 * Adds value to list.
78 *
79 * @param v value
80 */
81 public void addValue(Object v) {
82 values.add(v);
83 }
Gaurav Agrawal2779d362017-02-17 16:10:22 +053084}