Refactored SchemaPath for yang java types. Fixed SchemaPath for augmented nodes types.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / IdentityrefType.java
1 /*\r
2   * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3   *\r
4   * This program and the accompanying materials are made available under the\r
5   * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6   * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7   */\r
8 package org.opendaylight.controller.yang.model.util;\r
9 \r
10 import java.util.Collections;\r
11 import java.util.List;\r
12 \r
13 import org.opendaylight.controller.yang.common.QName;\r
14 import org.opendaylight.controller.yang.model.api.SchemaPath;\r
15 import org.opendaylight.controller.yang.model.api.Status;\r
16 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
17 import org.opendaylight.controller.yang.model.api.type.IdentityrefTypeDefinition;\r
18 \r
19 /**\r
20  * The <code>default</code> implementation of Identityref Type Definition interface.\r
21  *\r
22  * @see IdentityrefTypeDefinition\r
23  */\r
24 public final class IdentityrefType implements IdentityrefTypeDefinition {\r
25 \r
26     private final QName name = BaseTypes.constructQName("identityref");\r
27     private final SchemaPath path;\r
28     private final String description = "The identityref type is used to reference an existing identity.";\r
29     private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.10";\r
30     private final IdentityrefTypeDefinition baseType;\r
31 \r
32     private final QName identity;\r
33 \r
34     private String units = "";\r
35 \r
36     private IdentityrefType(QName identity) {\r
37         this.identity = identity;\r
38         this.path = BaseTypes.schemaPath(name);\r
39         this.baseType = this;\r
40     }\r
41 \r
42     public IdentityrefType(QName identity, SchemaPath schemaPath) {\r
43         this.identity = identity;\r
44         this.path = schemaPath;\r
45         this.baseType = new IdentityrefType(identity);\r
46     }\r
47 \r
48     @Override\r
49     public String getUnits() {\r
50         return units;\r
51     }\r
52 \r
53     @Override\r
54     public Object getDefaultValue() {\r
55         return identity;\r
56     }\r
57 \r
58     @Override\r
59     public QName getQName() {\r
60         return name;\r
61     }\r
62 \r
63     @Override\r
64     public SchemaPath getPath() {\r
65         return path;\r
66     }\r
67 \r
68     @Override\r
69     public String getDescription() {\r
70         return description;\r
71     }\r
72 \r
73     @Override\r
74     public String getReference() {\r
75         return reference;\r
76     }\r
77 \r
78     @Override\r
79     public Status getStatus() {\r
80         return Status.CURRENT;\r
81     }\r
82 \r
83     @Override\r
84     public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
85         return Collections.emptyList();\r
86     }\r
87 \r
88     @Override\r
89     public QName getIdentity() {\r
90         return identity;\r
91     }\r
92 \r
93     @Override\r
94     public IdentityrefTypeDefinition getBaseType() {\r
95         return baseType;\r
96     }\r
97 \r
98 }\r