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.api.type;
10 import java.util.Objects;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
18 * Contains method for getting data from <code>identityref</code> built-in YANG type.
20 public interface IdentityrefTypeDefinition extends TypeDefinition<IdentityrefTypeDefinition> {
22 * Returns the set of identities this reference points to.
24 * @return set of identities to which the instance of this type refers (in YANG 1.1 models) or a set containing
25 * just one identity (in YANG 1.0 models)
27 @NonNull Set<? extends IdentitySchemaNode> getIdentities();
29 static int hashCode(final @NonNull IdentityrefTypeDefinition type) {
30 return Objects.hash(type.getQName(), type.getUnknownSchemaNodes(), type.getBaseType(),
31 type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getIdentities());
34 static boolean equals(final @NonNull IdentityrefTypeDefinition type, final @Nullable Object obj) {
39 final IdentityrefTypeDefinition other = TypeDefinitions.castIfEquals(IdentityrefTypeDefinition.class, type,
41 return other != null && type.getIdentities().equals(other.getIdentities());
44 static String toString(final @NonNull IdentityrefTypeDefinition type) {
45 return TypeDefinitions.toStringHelper(type).add("identities", type.getIdentities()).toString();