2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.schema.builder.impl;
10 import java.util.Collections;
11 import java.util.List;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
17 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
18 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
19 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerAttrNode;
21 abstract class AbstractImmutableDataContainerNodeAttrBuilder<I extends YangInstanceIdentifier.PathArgument, R extends DataContainerNode<I>> extends AbstractImmutableDataContainerNodeBuilder<I, R> implements DataContainerNodeAttrBuilder<I, R> {
22 private Map<QName, String> attributes;
24 protected AbstractImmutableDataContainerNodeAttrBuilder() {
25 this.attributes = Collections.emptyMap();
28 protected AbstractImmutableDataContainerNodeAttrBuilder(final int sizeHint) {
30 this.attributes = Collections.emptyMap();
33 protected AbstractImmutableDataContainerNodeAttrBuilder(final AbstractImmutableDataContainerAttrNode<I> node) {
35 this.attributes = node.getAttributes();
38 protected final Map<QName, String> getAttributes() {
43 public DataContainerNodeAttrBuilder<I, R> withAttributes(final Map<QName, String> attributes){
44 this.attributes = attributes;
49 public DataContainerNodeAttrBuilder<I, R> withValue(final List<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value) {
50 return (DataContainerNodeAttrBuilder<I, R>) super.withValue(value);
54 public DataContainerNodeAttrBuilder<I, R> withChild(final DataContainerChild<?, ?> child) {
55 return (DataContainerNodeAttrBuilder<I, R>) super.withChild(child);
59 public DataContainerNodeAttrBuilder<I, R> withNodeIdentifier(final I nodeIdentifier) {
60 return (DataContainerNodeAttrBuilder<I, R>) super.withNodeIdentifier(nodeIdentifier);