import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
+import org.opendaylight.yangtools.yang.data.api.schema.SystemLeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.ListNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.valid.DataValidationException;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
public final class ImmutableLeafSetNodeSchemaAwareBuilder<T> extends ImmutableLeafSetNodeBuilder<T> {
-
private final LeafListSchemaNode schema;
private ImmutableLeafSetNodeSchemaAwareBuilder(final LeafListSchemaNode schema) {
super.withNodeIdentifier(new NodeIdentifier(schema.getQName()));
}
- public static <T> @NonNull ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafListSchemaNode schema) {
+ public static <T> @NonNull ListNodeBuilder<T, SystemLeafSetNode<T>> create(final LeafListSchemaNode schema) {
return new ImmutableLeafSetNodeSchemaAwareBuilder<>(schema);
}
- public static <T> @NonNull ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafListSchemaNode schema,
- final LeafSetNode<T> node) {
+ public static <T> @NonNull ListNodeBuilder<T, SystemLeafSetNode<T>> create(final LeafListSchemaNode schema,
+ final SystemLeafSetNode<T> node) {
if (!(node instanceof ImmutableLeafSetNode<?>)) {
throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
}
}
@Override
- public ListNodeBuilder<T, LeafSetEntryNode<T>> withChildValue(final T childValue) {
+ public ImmutableLeafSetNodeBuilder<T> withChildValue(final T childValue) {
// TODO check value type
return super.withChildValue(childValue);
}
@Override
- public ListNodeBuilder<T, LeafSetEntryNode<T>> withChild(final LeafSetEntryNode<T> child) {
+ public ImmutableLeafSetNodeBuilder<T> withChild(final LeafSetEntryNode<T> child) {
checkArgument(schema.getQName().equals(child.getNodeType()),
"Incompatible node type, should be: %s, is: %s", schema.getQName(), child.getNodeType());
// TODO check value type using TypeProvider ?
}
@Override
- public ListNodeBuilder<T, LeafSetEntryNode<T>> withNodeIdentifier(final NodeIdentifier withNodeIdentifier) {
+ public ImmutableLeafSetNodeBuilder<T> withNodeIdentifier(final NodeIdentifier withNodeIdentifier) {
throw new UnsupportedOperationException("Node identifier created from schema");
}
}