Populate data/ hierarchy
[yangtools.git] / model / yang-model-ri / src / main / java / org / opendaylight / yangtools / yang / model / ri / type / RestrictedLeafrefType.java
1 /*
2  * Copyright (c) 2015 Pantheon Technologies s.r.o. 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.ri.type;
9
10 import java.util.Collection;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.PathExpression;
13 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
15
16 final class RestrictedLeafrefType extends AbstractRestrictedType<LeafrefTypeDefinition>
17         implements LeafrefTypeDefinition {
18     private final boolean requireInstance;
19
20     RestrictedLeafrefType(final LeafrefTypeDefinition baseType, final QName qname,
21             final Collection<? extends UnknownSchemaNode> unknownSchemaNodes, final boolean requireInstance) {
22         super(baseType, qname, unknownSchemaNodes);
23         this.requireInstance = requireInstance;
24     }
25
26     @Override
27     public PathExpression getPathStatement() {
28         return getBaseType().getPathStatement();
29     }
30
31     @Override
32     public boolean requireInstance() {
33         return requireInstance;
34     }
35
36     @Override
37     public int hashCode() {
38         return LeafrefTypeDefinition.hashCode(this);
39     }
40
41     @Override
42     public boolean equals(final Object obj) {
43         return LeafrefTypeDefinition.equals(this, obj);
44     }
45
46     @Override
47     public String toString() {
48         return LeafrefTypeDefinition.toString(this);
49     }
50 }