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.util.type;
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.EnumTypeDefinition;
19 final class RestrictedEnumerationType extends AbstractRestrictedType<EnumTypeDefinition> implements EnumTypeDefinition {
20 private final List<EnumPair> values;
22 RestrictedEnumerationType(final EnumTypeDefinition baseType, final SchemaPath path,
23 final Collection<UnknownSchemaNode> unknownSchemaNodes, final Collection<EnumPair> values) {
24 super(baseType, path, unknownSchemaNodes);
25 this.values = ImmutableList.copyOf(Preconditions.checkNotNull(values));
30 public List<EnumPair> getValues() {
35 public int hashCode() {
36 return EnumTypeDefinition.hashCode(this);
40 public boolean equals(final Object obj) {
41 return EnumTypeDefinition.equals(this, obj);
45 public String toString() {
46 return EnumTypeDefinition.toString(this);