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.stmt.rfc6020.effective.type;
10 import com.google.common.base.Preconditions;
11 import com.google.common.collect.ImmutableList;
12 import java.util.Collection;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
16 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
19 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
20 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
21 import org.opendaylight.yangtools.yang.model.api.stmt.TypeEffectiveStatement;
22 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
23 import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
26 * Common shared effective statements for built-in types.
28 public enum BuiltinEffectiveStatement implements TypeEffectiveStatement<TypeStatement> {
29 BINARY(BaseTypes.binaryType()),
30 BOOLEAN(BaseTypes.booleanType()),
31 EMPTY(BaseTypes.emptyType()),
32 INSTANCE_IDENTIFIER(BaseTypes.instanceIdentifierType()),
33 INT8(BaseTypes.int8Type()),
34 INT16(BaseTypes.int16Type()),
35 INT32(BaseTypes.int32Type()),
36 INT64(BaseTypes.int64Type()),
37 STRING(BaseTypes.stringType()),
38 UINT8(BaseTypes.uint8Type()),
39 UINT16(BaseTypes.uint16Type()),
40 UINT32(BaseTypes.uint32Type()),
41 UINT64(BaseTypes.uint64Type());
43 private final TypeDefinition<?> typedef;
45 BuiltinEffectiveStatement(final TypeDefinition<?> typedef) {
46 this.typedef = Preconditions.checkNotNull(typedef);
50 public @Nonnull TypeDefinition<?> getTypeDefinition() {
55 public final TypeStatement getDeclared() {
60 public final <K, V, N extends IdentifierNamespace<K, V>> V get(@Nonnull final Class<N> namespace,
61 @Nonnull final K identifier) {
62 // TODO Auto-generated method stub
67 public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(@Nonnull final Class<N> namespace) {
68 // TODO Auto-generated method stub
74 public final Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
75 return ImmutableList.of();
80 public final StatementDefinition statementDefinition() {
81 return YangStmtMapping.TYPE;
85 public final String argument() {
86 return getTypeDefinition().getQName().getLocalName();
91 public final StatementSource getStatementSource() {
92 return StatementSource.CONTEXT;