27fdfacdfcef551961215d38542349788e65b368
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / Identityref.java
1 /*
2   * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3   *
4   * This program and the accompanying materials are made available under the
5   * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6   * and is available at http://www.eclipse.org/legal/epl-v10.html
7   */
8 package org.opendaylight.controller.yang.model.util;
9
10 import java.util.Collections;
11 import java.util.List;
12
13 import org.opendaylight.controller.yang.common.QName;
14 import org.opendaylight.controller.yang.model.api.RevisionAwareXPath;
15 import org.opendaylight.controller.yang.model.api.SchemaPath;
16 import org.opendaylight.controller.yang.model.api.Status;
17 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
18 import org.opendaylight.controller.yang.model.api.type.IdentityTypeDefinition;
19 import org.opendaylight.controller.yang.model.api.type.IdentityrefTypeDefinition;
20
21 /**
22  * The <code>default</code> implementation of Identityref Type Definition interface.
23  *
24  * @see IdentityrefTypeDefinition
25  */
26 public class Identityref implements IdentityrefTypeDefinition {
27
28     private final QName name = BaseTypes.constructQName("identityref");
29     private final SchemaPath path = BaseTypes.schemaPath(name);
30     private final String description = "The identityref type is used to reference an existing identity.";
31     private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.10";
32
33     private final IdentityTypeDefinition identity;
34     private final RevisionAwareXPath xpath;
35
36     private String units = "";
37
38     public Identityref(RevisionAwareXPath xpath, IdentityTypeDefinition identity) {
39         super();
40         this.identity = identity;
41         this.xpath = xpath;
42     }
43     
44     public Identityref(RevisionAwareXPath xpath) {
45         super();
46         this.xpath = xpath;
47         this.identity = null;
48     }
49
50     /*
51      * (non-Javadoc)
52      * 
53      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
54      */
55     @Override
56     public IdentityTypeDefinition getBaseType() {
57         return identity;
58     }
59
60     /*
61      * (non-Javadoc)
62      * 
63      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
64      */
65     @Override
66     public String getUnits() {
67         return units;
68     }
69
70     /*
71      * (non-Javadoc)
72      * 
73      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
74      */
75     @Override
76     public Object getDefaultValue() {
77         return identity;
78     }
79
80     /*
81      * (non-Javadoc)
82      * 
83      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
84      */
85     @Override
86     public QName getQName() {
87         return name;
88     }
89
90     /*
91      * (non-Javadoc)
92      * 
93      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
94      */
95     @Override
96     public SchemaPath getPath() {
97         return path;
98     }
99
100     /*
101      * (non-Javadoc)
102      * 
103      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
104      */
105     @Override
106     public String getDescription() {
107         return description;
108     }
109
110     /*
111      * (non-Javadoc)
112      * 
113      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
114      */
115     @Override
116     public String getReference() {
117         return reference;
118     }
119
120     /*
121      * (non-Javadoc)
122      * 
123      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
124      */
125     @Override
126     public Status getStatus() {
127         return Status.CURRENT;
128     }
129
130     @Override
131     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
132         return Collections.emptyList();
133     }
134
135     /*
136      * (non-Javadoc)
137      * 
138      * @see
139      * org.opendaylight.controller.yang.model.base.type.api.IdentityrefTypeDefinition#getIdentityName
140      * ()
141      */
142     @Override
143     public IdentityTypeDefinition getIdentity() {
144         return identity;
145     }
146     
147     @Override
148     public RevisionAwareXPath getPathStatement() {
149         return xpath;
150     }
151     
152     
153 }