Populate model/ hierarchy
[yangtools.git] / model / rfc6536-model-api / src / main / java / org / opendaylight / yangtools / rfc6536 / model / api / NACMStatements.java
1 /*
2  * Copyright (c) 2017 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.rfc6536.model.api;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.meta.ArgumentDefinition;
16 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
19
20 /**
21  * {@link StatementDefinition}s for statements defined by RFC6536.
22  *
23  * @author Robert Varga
24  */
25 @NonNullByDefault
26 public enum NACMStatements implements StatementDefinition {
27     DEFAULT_DENY_ALL(QName.create(NACMConstants.RFC6536_MODULE, "default-deny-all"), DefaultDenyAllStatement.class,
28         DefaultDenyAllEffectiveStatement.class),
29     DEFAULT_DENY_WRITE(QName.create(NACMConstants.RFC6536_MODULE, "default-deny-write"),
30         DefaultDenyWriteStatement.class, DefaultDenyWriteEffectiveStatement.class);
31
32     private final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation;
33     private final Class<? extends DeclaredStatement<?>> declaredRepresentation;
34     private final QName statementName;
35
36     NACMStatements(final QName statementName, final Class<? extends DeclaredStatement<?>> declaredRepresentation,
37             final Class<? extends EffectiveStatement<?, ?>> effectiveRepresentation) {
38         this.statementName = statementName.intern();
39         this.declaredRepresentation = requireNonNull(declaredRepresentation);
40         this.effectiveRepresentation = requireNonNull(effectiveRepresentation);
41     }
42
43     @Override
44     public Optional<ArgumentDefinition> getArgumentDefinition() {
45         return Optional.empty();
46     }
47
48     @Override
49     public QName getStatementName() {
50         return statementName;
51     }
52
53     @Override
54     public Class<? extends EffectiveStatement<?, ?>> getEffectiveRepresentationClass() {
55         return effectiveRepresentation;
56     }
57
58     @Override
59     public Class<? extends DeclaredStatement<?>> getDeclaredRepresentationClass() {
60         return declaredRepresentation;
61     }
62 }