Replaced Equals/HashcodeBuilder for DatapacketListener
[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.net.URI;\r
11 import java.util.Collections;\r
12 import java.util.Date;\r
13 import java.util.List;\r
14 \r
15 import org.opendaylight.controller.yang.common.QName;\r
16 import org.opendaylight.controller.yang.model.api.SchemaPath;\r
17 import org.opendaylight.controller.yang.model.api.Status;\r
18 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
19 import org.opendaylight.controller.yang.model.api.type.IdentityrefTypeDefinition;\r
20 \r
21 /**\r
22  * The <code>default</code> implementation of Identityref Type Definition interface.\r
23  *\r
24  * @see IdentityrefTypeDefinition\r
25  */\r
26 public class IdentityrefType implements IdentityrefTypeDefinition {\r
27 \r
28     private final QName name = BaseTypes.constructQName("identityref");\r
29     private final SchemaPath path;\r
30     private final String description = "The identityref type is used to reference an existing identity.";\r
31     private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.10";\r
32     private final IdentityrefTypeDefinition baseType;\r
33 \r
34     private final QName identity;\r
35 \r
36     private String units = "";\r
37 \r
38     private IdentityrefType(QName identity) {\r
39         this.identity = identity;\r
40         this.path = BaseTypes.schemaPath(name);\r
41         this.baseType = this;\r
42     }\r
43 \r
44     public IdentityrefType(QName identity, SchemaPath schemaPath) {\r
45         this.identity = identity;\r
46         this.path = schemaPath;\r
47         this.baseType = new IdentityrefType(identity);\r
48     }\r
49 \r
50     public IdentityrefType(final List<String> actualPath,\r
51             final URI namespace, final Date revision, final QName identity) {\r
52         this.identity = identity;\r
53         this.path = BaseTypes.schemaPath(actualPath, namespace, revision);\r
54         this.baseType = new IdentityrefType(identity);\r
55     }\r
56 \r
57     @Override\r
58     public String getUnits() {\r
59         return units;\r
60     }\r
61 \r
62     @Override\r
63     public Object getDefaultValue() {\r
64         return identity;\r
65     }\r
66 \r
67     @Override\r
68     public QName getQName() {\r
69         return name;\r
70     }\r
71 \r
72     @Override\r
73     public SchemaPath getPath() {\r
74         return path;\r
75     }\r
76 \r
77     @Override\r
78     public String getDescription() {\r
79         return description;\r
80     }\r
81 \r
82     @Override\r
83     public String getReference() {\r
84         return reference;\r
85     }\r
86 \r
87     @Override\r
88     public Status getStatus() {\r
89         return Status.CURRENT;\r
90     }\r
91 \r
92     @Override\r
93     public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
94         return Collections.emptyList();\r
95     }\r
96 \r
97     @Override\r
98     public QName getIdentity() {\r
99         return identity;\r
100     }\r
101 \r
102     @Override\r
103     public IdentityrefTypeDefinition getBaseType() {\r
104         return baseType;\r
105     }\r
106 \r
107 }\r