df8010bdc6b56679026ab0f45cd8b195ea7403ea
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / RecursiveDeleteCandidateNode.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.yang.data.impl.schema.tree;
9
10 import javax.annotation.Nonnull;
11 import com.google.common.base.Optional;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
17
18 final class RecursiveDeleteCandidateNode extends AbstractRecursiveCandidateNode {
19     RecursiveDeleteCandidateNode(final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> data) {
20         super(data);
21     }
22
23     @Override
24     @Nonnull
25     public ModificationType getModificationType() {
26         return ModificationType.DELETE;
27     }
28
29     @Override
30     protected DataTreeCandidateNode createContainer(
31             final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> childData) {
32         return new RecursiveDeleteCandidateNode(childData);
33     }
34
35     @Override
36     @Nonnull
37     public Optional<NormalizedNode<?, ?>> getDataAfter() {
38         return Optional.absent();
39     }
40
41     @Override
42     public Optional<NormalizedNode<?, ?>> getDataBefore() {
43         return dataOptional();
44     }
45
46     @Override
47     protected DataTreeCandidateNode createLeaf(final NormalizedNode<?, ?> childData) {
48         return new DeleteLeafCandidateNode(childData);
49     }
50 }