Fix invalid enum definition error string
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / type / RestrictedBitsType.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 com.google.common.collect.ImmutableList;
12 import java.util.Collection;
13 import java.util.List;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
18
19 final class RestrictedBitsType extends AbstractRestrictedType<BitsTypeDefinition> implements BitsTypeDefinition {
20     private final List<Bit> bits;
21
22     RestrictedBitsType(final BitsTypeDefinition baseType, final SchemaPath path,
23             final Collection<UnknownSchemaNode> unknownSchemaNodes, final Collection<Bit> bits) {
24         super(baseType, path, unknownSchemaNodes);
25         this.bits = ImmutableList.copyOf(Preconditions.checkNotNull(bits));
26     }
27
28     @Nonnull
29     @Override
30     public List<Bit> getBits() {
31         return bits;
32     }
33
34     @Override
35     public int hashCode() {
36         return BitsTypeDefinition.hashCode(this);
37     }
38
39     @Override
40     public boolean equals(final Object obj) {
41         return BitsTypeDefinition.equals(this, obj);
42     }
43
44     @Override
45     public String toString() {
46         return BitsTypeDefinition.toString(this);
47     }
48 }