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;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.model.api.PathExpression;
15 public interface LeafrefTypeDefinition extends RequireInstanceRestrictedTypeDefinition<LeafrefTypeDefinition> {
17 PathExpression getPathStatement();
23 * For YANG version 1 (RFC6020), this should always return true.
26 boolean requireInstance();
28 static int hashCode(final @NonNull LeafrefTypeDefinition type) {
29 return Objects.hash(type.getPath(), type.getUnknownSchemaNodes(), type.getBaseType(),
30 type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getPathStatement());
33 static boolean equals(final @NonNull LeafrefTypeDefinition type, final @Nullable Object obj) {
38 final LeafrefTypeDefinition other = TypeDefinitions.castIfEquals(LeafrefTypeDefinition.class, type, obj);
39 return other != null && type.getPathStatement().equals(other.getPathStatement());
42 static String toString(final @NonNull LeafrefTypeDefinition type) {
43 return TypeDefinitions.toStringHelper(type).add("pathStatement", type.getPathStatement()).toString();