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_POSIX_PATTERN(QName.create(OpenConfigConstants.REGEXP_POSIX_MODULE, "posix-pattern"), "pattern",
31 OpenConfigPosixPatternStatement.class, OpenConfigPosixPatternEffectiveStatement.class),
32 OPENCONFIG_REGEXP_POSIX(QName.create(OpenConfigConstants.REGEXP_POSIX_MODULE, "regexp-posix"), null,
33 OpenConfigRegexpPosixStatement.class, OpenConfigRegexpPosixEffectiveStatement.class),
34 OPENCONFIG_VERSION(QName.create(OpenConfigConstants.MODULE_NAMESPACE, "openconfig-version"), "semver",
35 OpenConfigVersionStatement.class, OpenConfigVersionEffectiveStatement.class);
37 private final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation;
38 private final Class<? extends DeclaredStatement<?>> declaredRepresentation;
39 private final QName statementName;
40 private final @Nullable QName argumentName;
42 @SuppressFBWarnings("NP_STORE_INTO_NONNULL_FIELD")
43 OpenConfigStatements(final QName statementName, @Nullable final String argumentName,
44 final Class<? extends DeclaredStatement<?>> declaredRepresentation,
45 final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation) {
46 this.statementName = statementName.intern();
47 this.argumentName = argumentName != null ? QName.create(statementName, argumentName) : null;
48 this.declaredRepresentation = requireNonNull(declaredRepresentation);
49 this.effectiveRepresentation = requireNonNull(effectiveRepresentation);
53 public QName getStatementName() {
58 public Optional<ArgumentDefinition> getArgumentDefinition() {
59 return ArgumentDefinition.ofNullable(argumentName, false);
63 public Class<? extends DeclaredStatement<?>> getDeclaredRepresentationClass() {
64 return declaredRepresentation;
68 public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
69 return effectiveRepresentation;