@Override
public void write(final YangInstanceIdentifier path, final NormalizedNode data) {
- checkSealed();
+ checkOpen();
checkIdentifierReferencesData(path, data);
resolveModificationFor(path).write(data);
}
@Override
public void merge(final YangInstanceIdentifier path, final NormalizedNode data) {
- checkSealed();
+ checkOpen();
checkIdentifierReferencesData(path, data);
resolveModificationFor(path).merge(data, version);
}
@Override
public void delete(final YangInstanceIdentifier path) {
- checkSealed();
-
+ checkOpen();
resolveModificationFor(path).delete();
}
return OperationWithModification.from(operation, modification);
}
- private void checkSealed() {
- checkState(!isSealed(), "Data Tree is sealed. No further modifications allowed.");
- }
-
@Override
public String toString() {
return "MutableDataTree [modification=" + rootNode + "]";
return (int) SEALED.getAcquire(this) != 0;
}
+ private void checkOpen() {
+ if (isSealed()) {
+ throw new IllegalStateException("Data Tree is sealed. No further modifications allowed.");
+ }
+ }
+
private static void applyChildren(final DataTreeModificationCursor cursor, final ModifiedNode node) {
if (!node.isEmpty()) {
cursor.enter(node.getIdentifier());