Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / type / BuiltinEffectiveStatement.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.parser.rfc7950.stmt.type;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.collect.ImmutableList;
13 import java.util.Collection;
14 import java.util.Map;
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;
25
26 /**
27  * Common shared effective statements for built-in types.
28  */
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());
43
44     private final TypeDefinition<?> typedef;
45
46     BuiltinEffectiveStatement(final TypeDefinition<?> typedef) {
47         this.typedef = requireNonNull(typedef);
48     }
49
50     @Override
51     public @Nonnull TypeDefinition<?> getTypeDefinition() {
52         return typedef;
53     }
54
55     @Override
56     public final TypeStatement getDeclared() {
57         return null;
58     }
59
60     @Override
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
64         return null;
65     }
66
67     @Override
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
70         return null;
71     }
72
73     @Nonnull
74     @Override
75     public final Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
76         return ImmutableList.of();
77     }
78
79     @Nonnull
80     @Override
81     public final StatementDefinition statementDefinition() {
82         return YangStmtMapping.TYPE;
83     }
84
85     @Override
86     public final String argument() {
87         return getTypeDefinition().getQName().getLocalName();
88     }
89
90     @Nonnull
91     @Override
92     public final StatementSource getStatementSource() {
93         return StatementSource.CONTEXT;
94     }
95 }