Do not pretty-print body class
[yangtools.git] / data / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / ImmutableAnyXmlNodeBuilder.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 javax.xml.transform.dom.DOMSource;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.DOMSourceAnyxmlNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.builder.NormalizedNodeBuilder;
15 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedSimpleValueNode;
16
17 public class ImmutableAnyXmlNodeBuilder
18         extends AbstractImmutableNormalizedNodeBuilder<NodeIdentifier, DOMSource, DOMSourceAnyxmlNode> {
19
20     public static @NonNull NormalizedNodeBuilder<NodeIdentifier, DOMSource, DOMSourceAnyxmlNode> create() {
21         return new ImmutableAnyXmlNodeBuilder();
22     }
23
24     @Override
25     public ImmutableAnyXmlNodeBuilder withValue(final DOMSource withValue) {
26         super.withValue(withValue);
27         return this;
28     }
29
30     @Override
31     public DOMSourceAnyxmlNode build() {
32         return new ImmutableXmlNode(getNodeIdentifier(), getValue());
33     }
34
35     private static final class ImmutableXmlNode
36             extends AbstractImmutableNormalizedSimpleValueNode<NodeIdentifier, DOMSourceAnyxmlNode, DOMSource>
37             implements DOMSourceAnyxmlNode {
38
39         ImmutableXmlNode(final NodeIdentifier nodeIdentifier, final DOMSource value) {
40             super(nodeIdentifier, value);
41         }
42
43         @Override
44         protected Class<DOMSourceAnyxmlNode> implementedType() {
45             return DOMSourceAnyxmlNode.class;
46         }
47     }
48 }