2 * Copyright (c) 2014 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.mdsal.binding.dom.codec.gen.impl;
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;
15 abstract class AugmentableDataNodeContainerEmitterSource extends DataNodeContainerSerializerSource {
16 private static final String AUGMENTABLE_SERIALIZER = "AUGMENTABLE_SERIALIZER";
18 AugmentableDataNodeContainerEmitterSource(final AbstractStreamWriterGenerator generator, final GeneratedType type,
19 final DataNodeContainer node) {
20 super(generator, type, node);
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.
25 staticConstant(AUGMENTABLE_SERIALIZER, DataObjectSerializerImplementation.class,
26 StreamWriterGenerator.AUGMENTABLE);
30 protected void emitAfterBody(final StringBuilder sb) {
31 sb.append(statement(invoke(AUGMENTABLE_SERIALIZER, "serialize", REGISTRY, INPUT, STREAM)));