2 * Copyright (c) 2017 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.odlext.model.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import java.util.Optional;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.meta.ArgumentDefinition;
17 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
18 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
23 public enum OpenDaylightExtensionsStatements implements StatementDefinition {
24 // Binding codegen support
25 AUGMENT_IDENTIFIER(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "augment-identifier"),
26 "identifier", AugmentIdentifierStatement.class, AugmentIdentifierEffectiveStatement.class),
29 CONTEXT_INSTANCE(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "context-instance"),
30 "context-type", ContextInstanceStatement.class, ContextInstanceEffectiveStatement.class),
31 CONTEXT_REFERENCE(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "context-reference"),
32 "context-type", ContextReferenceStatement.class, ContextReferenceEffectiveStatement.class),
33 INSTANCE_TARGET(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "instance-target"),
34 "path", InstanceTargetStatement.class, InstanceTargetEffectiveStatement.class),
35 RPC_CONTEXT_REFERENCE(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "rpc-context-reference"),
36 "context-type", RpcContextReferenceStatement.class, RpcContextReferenceEffectiveStatement.class);
38 private final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation;
39 private final Class<? extends DeclaredStatement<?>> declaredRepresentation;
40 private final QName statementName;
41 private final ArgumentDefinition argumentDef;
43 OpenDaylightExtensionsStatements(final QName statementName, final String argumentName,
44 final Class<? extends DeclaredStatement<?>> declaredRepresentation,
45 final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation) {
46 this.statementName = statementName.intern();
47 this.argumentDef = ArgumentDefinition.of(QName.create(statementName, argumentName).intern(), false);
48 this.declaredRepresentation = requireNonNull(declaredRepresentation);
49 this.effectiveRepresentation = requireNonNull(effectiveRepresentation);
53 public QName getStatementName() {
58 public Optional<ArgumentDefinition> getArgumentDefinition() {
59 return Optional.of(argumentDef);
63 public Class<? extends DeclaredStatement<?>> getDeclaredRepresentationClass() {
64 return declaredRepresentation;
68 public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
69 return effectiveRepresentation;