Merge "Bug 1354: Added rpcReplyToDomNodes method."
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / AbstractImmutableNormalizedNodeBuilder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.impl.schema.builder.impl;
9
10 import java.util.Collections;
11 import java.util.Map;
12
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.NormalizedNode;
16 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder;
17
18 abstract class AbstractImmutableNormalizedNodeBuilder<I extends YangInstanceIdentifier.PathArgument, V, R extends NormalizedNode<I, ?>>
19         implements NormalizedNodeAttrBuilder<I,V,R> {
20
21     private Map<QName, String> attributes = Collections.emptyMap();
22     private I nodeIdentifier;
23     private V value;
24
25     protected final I getNodeIdentifier() {
26         return nodeIdentifier;
27     }
28
29     protected final V getValue() {
30         return value;
31     }
32
33     protected final Map<QName, String> getAttributes() {
34         return attributes;
35     }
36
37     @Override
38     public NormalizedNodeAttrBuilder<I,V,R> withValue(final V value) {
39         this.value = value;
40         return this;
41     }
42
43     @Override
44     public NormalizedNodeAttrBuilder<I,V,R> withNodeIdentifier(final I nodeIdentifier) {
45         this.nodeIdentifier = nodeIdentifier;
46         return this;
47     }
48
49     @Override
50     public NormalizedNodeAttrBuilder<I,V,R> withAttributes(final Map<QName, String> attributes){
51         this.attributes = attributes;
52         return this;
53     }
54 }