public static DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> unkeyedListEntryBuilder() { return ImmutableUnkeyedListEntryNodeBuilder.create(); } }
public static DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> unkeyedListEntryBuilder() { return ImmutableUnkeyedListEntryNodeBuilder.create(); } }
@Override @SuppressWarnings("rawtypes") protected DataContainerNodeBuilder createBuilder(final NormalizedNode<?, ?> original) { checkArgument(original instanceof UnkeyedListEntryNode); return ImmutableUnkeyedListEntryNodeBuilder.create((UnkeyedListEntryNode) original); }
@Override @SuppressWarnings("rawtypes") protected DataContainerNodeBuilder createBuilder(final NormalizedNode<?, ?> original) { checkArgument(original instanceof UnkeyedListEntryNode); return ImmutableUnkeyedListEntryNodeBuilder.create((UnkeyedListEntryNode) original); }
@Override public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) { checkArgument(getCurrent() instanceof NormalizedNodeResultBuilder || getCurrent() instanceof ImmutableUnkeyedListNodeBuilder); final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder = UNKNOWN_SIZE == childSizeHint ? ImmutableUnkeyedListEntryNodeBuilder.create() : ImmutableUnkeyedListEntryNodeBuilder.create(childSizeHint); enter(builder.withNodeIdentifier(name)); }
@Override public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) { checkArgument(getCurrent() instanceof NormalizedNodeResultBuilder || getCurrent() instanceof ImmutableUnkeyedListNodeBuilder); final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder = UNKNOWN_SIZE == childSizeHint ? ImmutableUnkeyedListEntryNodeBuilder.create() : ImmutableUnkeyedListEntryNodeBuilder.create(childSizeHint); enter(builder.withNodeIdentifier(name)); }
@Override protected NormalizedNode<?, ?> createEmptyValue(final NormalizedNode<?, ?> original) { checkArgument(original instanceof UnkeyedListEntryNode); return ImmutableUnkeyedListEntryNodeBuilder.create() .withNodeIdentifier(((UnkeyedListEntryNode) original).getIdentifier()).build(); } }
@Override protected NormalizedNode<?, ?> createEmptyValue(final NormalizedNode<?, ?> original) { checkArgument(original instanceof UnkeyedListEntryNode); return ImmutableUnkeyedListEntryNodeBuilder.create() .withNodeIdentifier(((UnkeyedListEntryNode) original).getIdentifier()).build(); } }
@Override protected TreeNode applyWrite(final ModifiedNode modification, final NormalizedNode<?, ?> newValue, final Optional<TreeNode> currentMeta, final Version version) { final TreeNode newValueMeta = TreeNodeFactory.createTreeNode(newValue, version); if (modification.getChildren().isEmpty()) { return newValueMeta; } /* * This is where things get interesting. The user has performed a write and * then she applied some more modifications to it. So we need to make sense * of that an apply the operations on top of the written value. We could have * done it during the write, but this operation is potentially expensive, so * we have left it out of the fast path. * * As it turns out, once we materialize the written data, we can share the * code path with the subtree change. So let's create an unsealed TreeNode * and run the common parts on it -- which end with the node being sealed. */ final MutableTreeNode mutable = newValueMeta.mutable(); mutable.setSubtreeVersion(version); @SuppressWarnings("rawtypes") final NormalizedNodeContainerBuilder dataBuilder = ImmutableUnkeyedListEntryNodeBuilder .create((UnkeyedListEntryNode) newValue); return mutateChildren(mutable, dataBuilder, version, modification.getChildren()); }
@Override protected TreeNode applyWrite(final ModifiedNode modification, final Optional<TreeNode> currentMeta, final Version version) { final NormalizedNode<?, ?> newValue = modification.getWrittenValue(); final TreeNode newValueMeta = TreeNodeFactory.createTreeNode(newValue, version); if (modification.getChildren().isEmpty()) { return newValueMeta; } /* * This is where things get interesting. The user has performed a write and * then she applied some more modifications to it. So we need to make sense * of that an apply the operations on top of the written value. We could have * done it during the write, but this operation is potentially expensive, so * we have left it out of the fast path. * * As it turns out, once we materialize the written data, we can share the * code path with the subtree change. So let's create an unsealed TreeNode * and run the common parts on it -- which end with the node being sealed. */ final MutableTreeNode mutable = newValueMeta.mutable(); mutable.setSubtreeVersion(version); @SuppressWarnings("rawtypes") final NormalizedNodeContainerBuilder dataBuilder = ImmutableUnkeyedListEntryNodeBuilder .create((UnkeyedListEntryNode) newValue); return mutateChildren(mutable, dataBuilder, version, modification.getChildren()); }