2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.model.util;
10 import com.google.common.base.Preconditions;
11 import java.util.Collections;
12 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.Status;
17 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
21 * The <code>default</code> implementation of Identityref Type Definition
24 * @see IdentityrefTypeDefinition
25 * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#identityrefTypeBuilder(SchemaPath)} instead
28 public final class IdentityrefType implements IdentityrefTypeDefinition {
29 private static final QName NAME = BaseTypes.IDENTITYREF_QNAME;
30 private static final String DESCRIPTION = "The identityref type is used to reference an existing identity.";
31 private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.10";
32 private static final String UNITS = "";
34 private final IdentitySchemaNode identity;
35 private final SchemaPath path;
37 private IdentityrefType(final SchemaPath path, final IdentitySchemaNode baseIdentity) {
38 this.path = Preconditions.checkNotNull(path, "Path must be specified");
39 this.identity = Preconditions.checkNotNull(baseIdentity,"baseIdentity must be specified.");
43 * Constructs a new {@link IdentityrefTypeDefinition} definition.
45 * @param path Path to the definition.
46 * @param baseIdentity Base Identity, all derived identities are valid arguments for instance of this type.
47 * @return New identityref definition.
49 public static IdentityrefType create(final SchemaPath path, final IdentitySchemaNode baseIdentity) {
50 return new IdentityrefType(path, baseIdentity);
54 public String getUnits() {
59 public Object getDefaultValue() {
64 public QName getQName() {
69 public SchemaPath getPath() {
74 public String getDescription() {
79 public String getReference() {
84 public Status getStatus() {
85 return Status.CURRENT;
89 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
90 return Collections.emptyList();
94 public IdentitySchemaNode getIdentity() {
99 public IdentityrefTypeDefinition getBaseType() {
104 public String toString() {
105 return "identityref " + identity.getQName().getLocalName();