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.controller.md.sal.binding.api;
10 import java.util.Collection;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.binding.Augmentation;
14 import org.opendaylight.yangtools.yang.binding.ChildOf;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.opendaylight.yangtools.yang.binding.Identifiable;
17 import org.opendaylight.yangtools.yang.binding.Identifier;
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
21 * Modified Data Object.
23 * Represents modification of Data Object.
26 public interface DataObjectModification<T extends DataObject> extends org.opendaylight.yangtools.concepts.Identifiable<PathArgument> {
28 enum ModificationType {
31 * Child node (direct or indirect) was modified.
37 * Node was explicitly created / overwritten.
50 PathArgument getIdentifier();
53 * Returns type of modified object.
55 * @return type of modified object.
57 @Nonnull Class<T> getDataType();
61 * Returns type of modification
63 * @return type Type of performed modification.
65 @Nonnull ModificationType getModificationType();
68 * Returns after state of top level container.
70 * @param root Class representing data container
71 * @return State of object after modification. Null if subtree is not present.
73 @Nullable T getDataAfter();
76 * Returns unmodifiable collection of modified direct children.
78 * @return unmodifiable collection of modified direct children.
80 @Nonnull Collection<DataObjectModification<? extends DataObject>> getModifiedChildren();
83 * Returns container child modification if {@code child} was modified by this
86 * For accessing all modified list items consider iterating over {@link #getModifiedChildren()}.
88 * @param child Type of child - must be only container
89 * @return Modification of {@code child} if {@code child} was modified, null otherwise.
90 * @throws IllegalArgumentException If supplied {@code child} class is not valid child according
93 @Nullable <C extends ChildOf<? super T>> DataObjectModification<C> getModifiedChildContainer(@Nonnull Class<C> child);
96 * Returns augmentation child modification if {@code augmentation} was modified by this
99 * For accessing all modified list items consider iterating over {@link #getModifiedChildren()}.
101 * @param augmentation Type of augmentation - must be only container
102 * @return Modification of {@code augmentation} if {@code augmentation} was modified, null otherwise.
103 * @throws IllegalArgumentException If supplied {@code augmentation} class is not valid augmentation
104 * according to generated model.
106 @Nullable <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(@Nonnull Class<C> augmentation);
110 * Returns child list item modification if {@code child} was modified by this modification.
112 * @param listItem Type of list item - must be list item with key
113 * @param listKey List item key
114 * @return Modification of {@code child} if {@code child} was modified, null otherwise.
115 * @throws IllegalArgumentException If supplied {@code listItem} class is not valid child according
116 * to generated model.
118 <C extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
119 @Nonnull Class<C> listItem,@Nonnull K listKey);
122 * Returns a child modification if a node identified by {@code childArgument} was modified by
125 * @param childArgument Path Argument of child node
126 * @return Modification of child identified by {@code childArgument} if {@code childArgument}
127 * was modified, null otherwise.
128 * @throws IllegalArgumentException If supplied path argument is not valid child according to
132 @Nullable DataObjectModification<? extends DataObject> getModifiedChild(PathArgument childArgument);