if (rootSchemaNode instanceof ListSchemaNode) {
final PathArgument arg = treeConfig.getRootPath().getLastPathArgument();
if (arg instanceof NodeIdentifierWithPredicates) {
- return maskMandatory ? new ListEntryModificationStrategy((ListSchemaNode) rootSchemaNode, treeConfig)
- : ListEntryModificationStrategy.of((ListSchemaNode) rootSchemaNode, treeConfig);
+ return maskMandatory ? new MapEntryModificationStrategy((ListSchemaNode) rootSchemaNode, treeConfig)
+ : MapEntryModificationStrategy.of((ListSchemaNode) rootSchemaNode, treeConfig);
}
}
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-final class UnkeyedListModificationStrategy extends SchemaAwareApplyOperation<ListSchemaNode> {
+final class ListModificationStrategy extends SchemaAwareApplyOperation<ListSchemaNode> {
private static final NormalizedNodeContainerSupport<NodeIdentifier, UnkeyedListEntryNode> ITEM_SUPPORT =
new NormalizedNodeContainerSupport<>(UnkeyedListEntryNode.class,
ImmutableUnkeyedListEntryNodeBuilder::create, ImmutableUnkeyedListEntryNodeBuilder::create);
private final DataNodeContainerModificationStrategy<ListSchemaNode> entryStrategy;
private final UnkeyedListNode emptyNode;
- UnkeyedListModificationStrategy(final ListSchemaNode schema, final DataTreeConfiguration treeConfig) {
+ ListModificationStrategy(final ListSchemaNode schema, final DataTreeConfiguration treeConfig) {
entryStrategy = new DataNodeContainerModificationStrategy<>(ITEM_SUPPORT, schema, treeConfig);
emptyNode = ImmutableNodes.listNode(schema.getQName());
}
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-class ListEntryModificationStrategy extends DataNodeContainerModificationStrategy<ListSchemaNode> {
- private static final class EnforcingMandatory extends ListEntryModificationStrategy {
+class MapEntryModificationStrategy extends DataNodeContainerModificationStrategy<ListSchemaNode> {
+ private static final class EnforcingMandatory extends MapEntryModificationStrategy {
private final MandatoryLeafEnforcer enforcer;
EnforcingMandatory(final ListSchemaNode schemaNode, final DataTreeConfiguration treeConfig,
new NormalizedNodeContainerSupport<>(MapEntryNode.class, ImmutableMapEntryNodeBuilder::create,
ImmutableMapEntryNodeBuilder::create);
- ListEntryModificationStrategy(final ListSchemaNode schema, final DataTreeConfiguration treeConfig) {
+ MapEntryModificationStrategy(final ListSchemaNode schema, final DataTreeConfiguration treeConfig) {
super(SUPPORT, schema, treeConfig);
}
- static @NonNull ListEntryModificationStrategy of(final ListSchemaNode schema,
+ static @NonNull MapEntryModificationStrategy of(final ListSchemaNode schema,
final DataTreeConfiguration treeConfig) {
final Optional<MandatoryLeafEnforcer> enforcer = MandatoryLeafEnforcer.forContainer(schema, treeConfig);
return enforcer.isPresent() ? new EnforcingMandatory(schema, treeConfig, enforcer.get())
- : new ListEntryModificationStrategy(schema, treeConfig);
+ : new MapEntryModificationStrategy(schema, treeConfig);
}
}
private MapModificationStrategy(final NormalizedNodeContainerSupport<?, ?> support, final ListSchemaNode schema,
final DataTreeConfiguration treeConfig, final MapNode emptyNode) {
- super(support, treeConfig, ListEntryModificationStrategy.of(schema, treeConfig));
+ super(support, treeConfig, MapEntryModificationStrategy.of(schema, treeConfig));
this.emptyNode = requireNonNull(emptyNode);
}
final List<QName> keyDefinition = schemaNode.getKeyDefinition();
final SchemaAwareApplyOperation<ListSchemaNode> op;
if (keyDefinition == null || keyDefinition.isEmpty()) {
- op = new UnkeyedListModificationStrategy(schemaNode, treeConfig);
+ op = new ListModificationStrategy(schemaNode, treeConfig);
} else {
op = MapModificationStrategy.of(schemaNode, treeConfig);
}
final InMemoryDataTree imdt = (InMemoryDataTree) dataTree;
final InMemoryDataTreeModification mod = imdt.takeSnapshot().newModification();
final ModificationApplyOperation strategy = mod.getStrategy();
- assertThat(strategy, instanceOf(ListEntryModificationStrategy.class));
+ assertThat(strategy, instanceOf(MapEntryModificationStrategy.class));
}
}