2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.mdsal.binding.javav2.dom.codec.generator.spi.source;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.mdsal.binding.javav2.dom.codec.generator.impl.StreamWriterGenerator;
12 import org.opendaylight.mdsal.binding.javav2.dom.codec.generator.spi.generator.AbstractStreamWriterGenerator;
13 import org.opendaylight.mdsal.binding.javav2.model.api.GeneratedType;
14 import org.opendaylight.mdsal.binding.javav2.spec.runtime.TreeNodeSerializerImplementation;
15 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
18 public abstract class AbstractAugmentableDataNodeContainerEmitterSource
19 extends AbstractDataNodeContainerSerializerSource {
21 private static final String AUGMENTABLE_SERIALIZER = "AUGMENTABLE_SERIALIZER";
23 public AbstractAugmentableDataNodeContainerEmitterSource(final AbstractStreamWriterGenerator generator,
24 final GeneratedType type, final DataNodeContainer node) {
25 super(generator, type, node);
27 * Eventhough intuition says the serializer could reference the
28 * generator directly, that is not true in OSGi environment -- so we
29 * need to resolve the reference first and inject it as a static
32 staticConstant(AUGMENTABLE_SERIALIZER, TreeNodeSerializerImplementation.class,
33 StreamWriterGenerator.AUGMENTABLE);
37 protected void emitAfterBody(final StringBuilder builder) {
38 builder.append(statement(invoke(AUGMENTABLE_SERIALIZER, "serialize", REGISTRY, INPUT, STREAM)));