2 * Copyright (c) 2015 Pantheon Technologies s.r.o. 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.spi.type;
10 import java.util.Collection;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
13 import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
15 final class RestrictedInstanceIdentifierType extends AbstractRestrictedType<InstanceIdentifierTypeDefinition>
16 implements InstanceIdentifierTypeDefinition {
17 private final boolean requireInstance;
19 RestrictedInstanceIdentifierType(final InstanceIdentifierTypeDefinition baseType, final QName qname,
20 final Collection<? extends UnknownSchemaNode> unknownSchemaNodes, final boolean requireInstance) {
21 super(baseType, qname, unknownSchemaNodes);
22 this.requireInstance = requireInstance;
25 private RestrictedInstanceIdentifierType(final RestrictedInstanceIdentifierType original, final QName qname) {
26 super(original, qname);
27 this.requireInstance = original.requireInstance;
31 RestrictedInstanceIdentifierType bindTo(final QName newQName) {
32 return new RestrictedInstanceIdentifierType(this, newQName);
36 public boolean requireInstance() {
37 return requireInstance;
41 public int hashCode() {
42 return InstanceIdentifierTypeDefinition.hashCode(this);
46 public boolean equals(final Object obj) {
47 return InstanceIdentifierTypeDefinition.equals(this, obj);
51 public String toString() {
52 return InstanceIdentifierTypeDefinition.toString(this);