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;
14 abstract class AugmentableDataNodeContainerEmitterSource extends DataNodeContainerSerializerSource {
15 private static final String AUGMENTABLE_SERIALIZER = "AUGMENTABLE_SERIALIZER";
17 public AugmentableDataNodeContainerEmitterSource(final AbstractStreamWriterGenerator generator, final GeneratedType type, final DataNodeContainer node) {
18 super(generator, type, node);
20 * Eventhough intuition says the serializer could reference the generator directly,
21 * that is not true in OSGi environment -- so we need to resolve the reference first
22 * and inject it as a static constant.
24 staticConstant(AUGMENTABLE_SERIALIZER, DataObjectSerializerImplementation.class, StreamWriterGenerator.AUGMENTABLE);
28 protected void emitAfterBody(final StringBuilder b) {
29 b.append(statement(invoke(AUGMENTABLE_SERIALIZER, "serialize", REGISTRY, INPUT, STREAM)));