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 java.util.Collection;
15 import javax.annotation.Nonnull;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
17 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
18 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
20 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
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 TypeDefinition<?> typedef;
46 BuiltinEffectiveStatement(final TypeDefinition<?> typedef) {
47 this.typedef = requireNonNull(typedef);
51 public @Nonnull TypeDefinition<?> getTypeDefinition() {
56 public final TypeStatement getDeclared() {
61 public final <K, V, N extends IdentifierNamespace<K, V>> V get(@Nonnull final Class<N> namespace,
62 @Nonnull final K identifier) {
63 // TODO Auto-generated method stub
68 public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(@Nonnull final Class<N> namespace) {
69 // TODO Auto-generated method stub
75 public final Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
76 return ImmutableList.of();
81 public final StatementDefinition statementDefinition() {
82 return YangStmtMapping.TYPE;
86 public final String argument() {
87 return getTypeDefinition().getQName().getLocalName();
92 public final StatementSource getStatementSource() {
93 return StatementSource.CONTEXT;