Enable checkstyle in yang-model-util
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / type / BaseIdentityrefType.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.util.type;
9
10 import com.google.common.base.Preconditions;
11 import java.util.List;
12 import java.util.Set;
13 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
17
18 final class BaseIdentityrefType extends AbstractBaseType<IdentityrefTypeDefinition>
19         implements IdentityrefTypeDefinition {
20     private final IdentitySchemaNode identity;
21     private final Set<IdentitySchemaNode> identities;
22
23     BaseIdentityrefType(final SchemaPath path, final List<UnknownSchemaNode> unknownSchemaNodes,
24             final IdentitySchemaNode identity, final Set<IdentitySchemaNode> identities) {
25         super(path, unknownSchemaNodes);
26         this.identity = Preconditions.checkNotNull(identity);
27         this.identities = Preconditions.checkNotNull(identities);
28     }
29
30     @Override
31     public IdentitySchemaNode getIdentity() {
32         return identity;
33     }
34
35     @Override
36     public Set<IdentitySchemaNode> getIdentities() {
37         return identities;
38     }
39
40     @Override
41     public int hashCode() {
42         return TypeDefinitions.hashCode(this);
43     }
44
45     @Override
46     public boolean equals(final Object obj) {
47         return TypeDefinitions.equals(this, obj);
48     }
49
50     @Override
51     public String toString() {
52         return TypeDefinitions.toString(this);
53     }
54 }