Fixing sonar issues 4
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / IdentityrefType.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.yangtools.yang.model.util;
9
10 import java.util.Collections;
11 import java.util.List;
12
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 import org.opendaylight.yangtools.yang.model.api.Status;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
18
19 /**
20  * The <code>default</code> implementation of Identityref Type Definition
21  * interface.
22  * 
23  * @see IdentityrefTypeDefinition
24  */
25 public final class IdentityrefType implements IdentityrefTypeDefinition {
26     private final QName name = BaseTypes.constructQName("identityref");
27     private final SchemaPath path;
28     private static final String DESCRIPTION = "The identityref type is used to reference an existing identity.";
29     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.10";
30     private final IdentityrefTypeDefinition baseType;
31     private final QName identity;
32     private static final String UNITS = "";
33
34     public IdentityrefType(QName identity, SchemaPath schemaPath) {
35         this.identity = identity;
36         this.path = schemaPath;
37         this.baseType = this;
38     }
39
40     @Override
41     public String getUnits() {
42         return UNITS;
43     }
44
45     @Override
46     public Object getDefaultValue() {
47         return identity;
48     }
49
50     @Override
51     public QName getQName() {
52         return name;
53     }
54
55     @Override
56     public SchemaPath getPath() {
57         return path;
58     }
59
60     @Override
61     public String getDescription() {
62         return DESCRIPTION;
63     }
64
65     @Override
66     public String getReference() {
67         return REFERENCE;
68     }
69
70     @Override
71     public Status getStatus() {
72         return Status.CURRENT;
73     }
74
75     @Override
76     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
77         return Collections.emptyList();
78     }
79
80     @Override
81     public QName getIdentity() {
82         return identity;
83     }
84
85     @Override
86     public IdentityrefTypeDefinition getBaseType() {
87         return baseType;
88     }
89
90     @Override
91     public String toString() {
92         return "identityref " + identity.getLocalName();
93     }
94
95 }