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