public static <T> NormalizedNodeAttrBuilder<NodeIdentifier, T, LeafNode<T>> create() { return new ImmutableLeafNodeBuilder<>(); }
public static <T> NormalizedNodeAttrBuilder<NodeIdentifier, T, LeafNode<T>> leafBuilder() { return ImmutableLeafNodeBuilder.create(); }
@Override @SuppressWarnings("unchecked") public LeafNode<T> build() { final T value = getValue(); if (value instanceof byte[]) { return (LeafNode<T>) new ImmutableBinaryLeafNode(getNodeIdentifier(), (byte[]) value, getAttributes()); } return new ImmutableLeafNode<>(getNodeIdentifier(), value, getAttributes()); }
@Override public NormalizedNodeAttrBuilder<NodeIdentifier, T, LeafNode<T>> withValue(final T withValue) { // TODO: check value type return super.withValue(withValue); }
private ImmutableLeafNodeSchemaAwareBuilder(final LeafSchemaNode schema) { super.withNodeIdentifier(NodeIdentifier.create(schema.getQName())); }
@Override public NormalizedNodeAttrBuilder<NodeIdentifier, T, LeafNode<T>> withValue(final T withValue) { // TODO: check value type return super.withValue(withValue); }
private ImmutableLeafNodeSchemaAwareBuilder(final LeafSchemaNode schema) { super.withNodeIdentifier(NodeIdentifier.create(schema.getQName())); }
@Override @SuppressWarnings("unchecked") public LeafNode<T> build() { final T value = getValue(); if (value instanceof byte[]) { return (LeafNode<T>) new ImmutableBinaryLeafNode(getNodeIdentifier(), (byte[]) value, getAttributes()); } return new ImmutableLeafNode<>(getNodeIdentifier(), value, getAttributes()); }
public static <T> NormalizedNodeAttrBuilder<NodeIdentifier, T, LeafNode<T>> leafBuilder() { return ImmutableLeafNodeBuilder.create(); }
public static <T> NormalizedNodeAttrBuilder<NodeIdentifier, T, LeafNode<T>> create() { return new ImmutableLeafNodeBuilder<>(); }
/** * Construct immutable leaf node. * * @param name Identifier of leaf node * @param value Value of leaf node * @param <T> Type of leaf node value * @return Leaf node with supplied identifier and value */ public static <T> LeafNode<T> leafNode(final NodeIdentifier name, final T value) { return ImmutableLeafNodeBuilder.<T>create() .withNodeIdentifier(name) .withValue(value) .build(); }
/** * Construct immutable leaf node. * * @param name Identifier of leaf node * @param value Value of leaf node * @param <T> Type of leaf node value * @return Leaf node with supplied identifier and value */ public static <T> LeafNode<T> leafNode(final NodeIdentifier name, final T value) { return ImmutableLeafNodeBuilder.<T>create() .withNodeIdentifier(name) .withValue(value) .build(); }