Bump upstreams
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / OperationsLeafSchemaNode.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, 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.restconf.nb.rfc8040.rests.services.impl;
9
10 import java.util.Collection;
11 import java.util.List;
12 import java.util.Set;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
17 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
18 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
19 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
20 import org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement;
21 import org.opendaylight.yangtools.yang.model.api.stmt.LeafStatement;
22 import org.opendaylight.yangtools.yang.model.ri.type.BaseTypes;
23
24 @Deprecated(forRemoval = true, since = "4.0.0")
25 final class OperationsLeafSchemaNode extends AbstractOperationDataSchemaNode<LeafStatement>
26         implements LeafSchemaNode, LeafEffectiveStatement {
27     private final QName qname;
28
29     OperationsLeafSchemaNode(final RpcDefinition rpc) {
30         qname = rpc.getQName();
31     }
32
33     @Override
34     public TypeDefinition<?> getType() {
35         return BaseTypes.emptyType();
36     }
37
38     @Override
39     public QName argument() {
40         return qname;
41     }
42
43     @Override
44     public boolean isMandatory() {
45         // This leaf has to be present
46         return true;
47     }
48
49     @Override
50     public Collection<@NonNull MustDefinition> getMustConstraints() {
51         return Set.of();
52     }
53
54     @Override
55     public LeafEffectiveStatement asEffectiveStatement() {
56         return this;
57     }
58
59     @Override
60     public List<EffectiveStatement<?, ?>> effectiveSubstatements() {
61         // FIXME: a 'type empty; mandatory true;' substatements, actually
62         return List.of();
63     }
64 }