Bump versions for mdsal-5.0.0
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / gen / impl / AugmentableDataNodeContainerEmitterSource.java
1 /*
2  * Copyright (c) 2014 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.mdsal.binding.dom.codec.gen.impl;
9
10 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
11 import org.opendaylight.yangtools.yang.binding.DataObjectSerializerImplementation;
12 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
13
14 @Deprecated
15 abstract class AugmentableDataNodeContainerEmitterSource extends DataNodeContainerSerializerSource {
16     private static final String AUGMENTABLE_SERIALIZER = "AUGMENTABLE_SERIALIZER";
17
18     AugmentableDataNodeContainerEmitterSource(final AbstractStreamWriterGenerator generator, final GeneratedType type,
19             final DataNodeContainer node) {
20         super(generator, type, node);
21         /*
22          * Eventhough intuition says the serializer could reference the generator directly, that is not true in OSGi
23          * environment -- so we need to resolve the reference first and inject it as a static constant.
24          */
25         staticConstant(AUGMENTABLE_SERIALIZER, DataObjectSerializerImplementation.class,
26             StreamWriterGenerator.AUGMENTABLE);
27     }
28
29     @Override
30     protected void emitAfterBody(final StringBuilder sb) {
31         sb.append(statement(invoke(AUGMENTABLE_SERIALIZER, "serialize", REGISTRY, INPUT, STREAM)));
32     }
33 }