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.parser.rfc7950.stmt.type;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.collect.ImmutableList;
13 import com.google.common.collect.ImmutableMap;
14 import java.util.Collection;
16 import java.util.Optional;
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
19 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
20 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
21 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
22 import org.opendaylight.yangtools.yang.model.api.stmt.TypeEffectiveStatement;
23 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
24 import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
27 * Common shared effective statements for built-in types.
29 enum BuiltinEffectiveStatement implements TypeEffectiveStatement<TypeStatement> {
30 BINARY(BaseTypes.binaryType()),
31 BOOLEAN(BaseTypes.booleanType()),
32 EMPTY(BaseTypes.emptyType()),
33 INSTANCE_IDENTIFIER(BaseTypes.instanceIdentifierType()),
34 INT8(BaseTypes.int8Type()),
35 INT16(BaseTypes.int16Type()),
36 INT32(BaseTypes.int32Type()),
37 INT64(BaseTypes.int64Type()),
38 STRING(BaseTypes.stringType()),
39 UINT8(BaseTypes.uint8Type()),
40 UINT16(BaseTypes.uint16Type()),
41 UINT32(BaseTypes.uint32Type()),
42 UINT64(BaseTypes.uint64Type());
44 private final @NonNull TypeDefinition<?> typedef;
46 BuiltinEffectiveStatement(final TypeDefinition<?> typedef) {
47 this.typedef = requireNonNull(typedef);
51 public TypeDefinition<?> getTypeDefinition() {
56 public final TypeStatement getDeclared() {
61 public final <K, V, N extends IdentifierNamespace<K, V>> Optional<? extends V> get(final Class<N> namespace,
63 // FIXME: 7.0.0: implement this
64 return Optional.empty();
68 public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(final Class<N> namespace) {
69 // FIXME: 7.0.0: implement this
70 return ImmutableMap.of();
74 public final Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
75 return ImmutableList.of();
79 public final String argument() {
80 return getTypeDefinition().getQName().getLocalName();
84 public final StatementSource getStatementSource() {
85 return StatementSource.CONTEXT;