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.yangtools.binding.data.codec.gen.impl;
10 import org.opendaylight.yangtools.yang.binding.BindingStreamEventWriter;
11 import org.opendaylight.yangtools.yang.binding.DataObject;
12 import org.opendaylight.yangtools.yang.binding.DataObjectSerializerImplementation;
13 import org.opendaylight.yangtools.yang.binding.DataObjectSerializerRegistry;
16 * Prototype of a DataObjectSerializerImplementation. This is a template class, which the
17 * {@link AbstractStreamWriterGenerator} uses to instantiate {@link DataObjectSerializerImplementation}
18 * on a per-type basis. During that time, the {@link #serialize(DataObjectSerializerRegistry, DataObject, BindingStreamEventWriter)}
19 * method will be replaced by the real implementation.
21 final class DataObjectSerializerPrototype implements DataObjectSerializerImplementation {
22 private static final DataObjectSerializerPrototype INSTANCE = new DataObjectSerializerPrototype();
24 private DataObjectSerializerPrototype() {
25 // Intentionally hidden, subclasses can replace it
29 * Return the shared serializer instance.
31 * @return Global singleton instance.
33 public static DataObjectSerializerPrototype getInstance() {
38 public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj, final BindingStreamEventWriter stream) {
39 throw new UnsupportedOperationException("Prototype body, this code should never be invoked.");