b264a20e1e150bd9b11ef7b808dcf9b36f27d139
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / ReplaceLeafCandidateNode.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 com.google.common.base.Optional;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13
14 final class ReplaceLeafCandidateNode extends AbstractWriteCandidate {
15     private final NormalizedNode<?, ?> oldData;
16
17     ReplaceLeafCandidateNode(final NormalizedNode<?, ?> oldData, final NormalizedNode<?, ?> newData) {
18         super(newData);
19         this.oldData = Preconditions.checkNotNull(oldData);
20     }
21
22     @Override
23     public Optional<NormalizedNode<?, ?>> getDataBefore() {
24         return Optional.of(oldData);
25     }
26 }