2 * Copyright (c) 2015 Cisco Systems, Inc. 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.yang.data.codec.binfmt;
10 import static java.util.Objects.requireNonNull;
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
17 import org.opendaylight.yangtools.yang.data.tree.api.ModificationType;
20 * Abstract base class for our internal implementation of {@link DataTreeCandidateNode},
21 * which we instantiate from a serialized stream. We do not retain the before-image and
22 * do not implement {@link #getModifiedChild(PathArgument)}, as that method is only
23 * useful for end users. Instances based on this class should never be leaked outside of
26 abstract class AbstractDataTreeCandidateNode implements DataTreeCandidateNode {
27 private final @NonNull ModificationType type;
29 AbstractDataTreeCandidateNode(final ModificationType type) {
30 this.type = requireNonNull(type);
34 public final Optional<DataTreeCandidateNode> getModifiedChild(final PathArgument identifier) {
35 throw new UnsupportedOperationException("Not implemented");
39 public final ModificationType getModificationType() {
44 public final Optional<NormalizedNode> getDataBefore() {
45 throw new UnsupportedOperationException("Before-image not available after serialization");