Merge "add getIntValue() method to EnumTemplate so that representing value can by...
[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 QName identity;
31     private static final String UNITS = "";
32
33     public IdentityrefType(QName identity, SchemaPath schemaPath) {
34         this.identity = identity;
35         this.path = schemaPath;
36     }
37
38     @Override
39     public String getUnits() {
40         return UNITS;
41     }
42
43     @Override
44     public Object getDefaultValue() {
45         return identity;
46     }
47
48     @Override
49     public QName getQName() {
50         return name;
51     }
52
53     @Override
54     public SchemaPath getPath() {
55         return path;
56     }
57
58     @Override
59     public String getDescription() {
60         return DESCRIPTION;
61     }
62
63     @Override
64     public String getReference() {
65         return REFERENCE;
66     }
67
68     @Override
69     public Status getStatus() {
70         return Status.CURRENT;
71     }
72
73     @Override
74     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
75         return Collections.emptyList();
76     }
77
78     @Override
79     public QName getIdentity() {
80         return identity;
81     }
82
83     @Override
84     public IdentityrefTypeDefinition getBaseType() {
85         return null;
86     }
87
88     @Override
89     public String toString() {
90         return "identityref " + identity.getLocalName();
91     }
92
93 }