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.openconfig.model.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14 import java.util.Optional;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.model.api.meta.ArgumentDefinition;
19 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
20 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
21 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
25 public enum OpenConfigStatements implements StatementDefinition {
26 OPENCONFIG_ENCRYPTED_VALUE(QName.create(OpenConfigConstants.ENCRYPTED_VALUE_MODULE, "openconfig-encrypted-value"),
27 null, OpenConfigHashedValueStatement.class, OpenConfigHashedValueEffectiveStatement.class),
28 OPENCONFIG_HASHED_VALUE(QName.create(OpenConfigConstants.HASHED_VALUE_MODULE, "openconfig-hashed-value"), null,
29 OpenConfigHashedValueStatement.class, OpenConfigHashedValueEffectiveStatement.class),
30 OPENCONFIG_VERSION(QName.create(OpenConfigConstants.MODULE_NAMESPACE, "openconfig-version"), "semver",
31 OpenConfigVersionStatement.class, OpenConfigVersionEffectiveStatement.class);
33 private final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation;
34 private final Class<? extends DeclaredStatement<?>> declaredRepresentation;
35 private final QName statementName;
36 private final @Nullable QName argumentName;
38 @SuppressFBWarnings("NP_STORE_INTO_NONNULL_FIELD")
39 OpenConfigStatements(final QName statementName, @Nullable final String argumentName,
40 final Class<? extends DeclaredStatement<?>> declaredRepresentation,
41 final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation) {
42 this.statementName = statementName.intern();
43 this.argumentName = argumentName != null ? QName.create(statementName, argumentName) : null;
44 this.declaredRepresentation = requireNonNull(declaredRepresentation);
45 this.effectiveRepresentation = requireNonNull(effectiveRepresentation);
49 public QName getStatementName() {
54 public Optional<ArgumentDefinition> getArgumentDefinition() {
55 return ArgumentDefinition.ofNullable(argumentName, false);
59 public Class<? extends DeclaredStatement<?>> getDeclaredRepresentationClass() {
60 return declaredRepresentation;
64 public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
65 return effectiveRepresentation;