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.Collection;
11 import java.util.Collections;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
16 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
17 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
18 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerAttrNode;
20 abstract class AbstractImmutableDataContainerNodeAttrBuilder<I extends YangInstanceIdentifier.PathArgument, R extends DataContainerNode<I>> extends AbstractImmutableDataContainerNodeBuilder<I, R> implements DataContainerNodeAttrBuilder<I, R> {
21 private Map<QName, String> attributes;
23 protected AbstractImmutableDataContainerNodeAttrBuilder() {
24 this.attributes = Collections.emptyMap();
27 protected AbstractImmutableDataContainerNodeAttrBuilder(final int sizeHint) {
29 this.attributes = Collections.emptyMap();
32 protected AbstractImmutableDataContainerNodeAttrBuilder(final AbstractImmutableDataContainerAttrNode<I> node) {
34 this.attributes = node.getAttributes();
37 protected final Map<QName, String> getAttributes() {
42 public DataContainerNodeAttrBuilder<I, R> withAttributes(final Map<QName, String> attributes){
43 this.attributes = attributes;
48 public DataContainerNodeAttrBuilder<I, R> withValue(final Collection<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value) {
49 return (DataContainerNodeAttrBuilder<I, R>) super.withValue(value);
53 public DataContainerNodeAttrBuilder<I, R> withChild(final DataContainerChild<?, ?> child) {
54 return (DataContainerNodeAttrBuilder<I, R>) super.withChild(child);
58 public DataContainerNodeAttrBuilder<I, R> withNodeIdentifier(final I nodeIdentifier) {
59 return (DataContainerNodeAttrBuilder<I, R>) super.withNodeIdentifier(nodeIdentifier);