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.NonNull;
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;
22 public enum OpenDaylightExtensionsStatements implements StatementDefinition {
23 // Binding codegen support
24 AUGMENT_IDENTIFIER(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "augment-identifier"),
25 "identifier", AugmentIdentifierStatement.class, AugmentIdentifierEffectiveStatement.class),
28 MOUNT(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "mount"), null,
29 MountStatement.class, MountEffectiveStatement.class),
32 CONTEXT_INSTANCE(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "context-instance"),
33 "context-type", ContextInstanceStatement.class, ContextInstanceEffectiveStatement.class),
34 CONTEXT_REFERENCE(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "context-reference"),
35 "context-type", ContextReferenceStatement.class, ContextReferenceEffectiveStatement.class),
36 INSTANCE_TARGET(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "instance-target"),
37 "path", InstanceTargetStatement.class, InstanceTargetEffectiveStatement.class),
38 RPC_CONTEXT_REFERENCE(QName.create(OpenDaylightExtensionsConstants.ORIGINAL_MODULE, "rpc-context-reference"),
39 "context-type", RpcContextReferenceStatement.class, RpcContextReferenceEffectiveStatement.class);
41 private final @NonNull Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation;
42 private final @NonNull Class<? extends DeclaredStatement<?>> declaredRepresentation;
43 private final @NonNull QName statementName;
44 private final ArgumentDefinition argumentDef;
46 OpenDaylightExtensionsStatements(final QName statementName, final String argumentName,
47 final Class<? extends DeclaredStatement<?>> declaredRepresentation,
48 final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation) {
49 this.statementName = statementName.intern();
50 this.argumentDef = argumentName == null ? null
51 : ArgumentDefinition.of(QName.create(statementName, argumentName).intern(), false);
52 this.declaredRepresentation = requireNonNull(declaredRepresentation);
53 this.effectiveRepresentation = requireNonNull(effectiveRepresentation);
57 public QName getStatementName() {
62 public Optional<ArgumentDefinition> getArgumentDefinition() {
63 return Optional.ofNullable(argumentDef);
67 public Class<? extends DeclaredStatement<?>> getDeclaredRepresentationClass() {
68 return declaredRepresentation;
72 public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
73 return effectiveRepresentation;