Fix checkstyle in mdsal-binding2-dom-codec
[mdsal.git] / binding2 / mdsal-binding2-dom-codec / src / main / java / org / opendaylight / mdsal / binding / javav2 / dom / codec / generator / impl / TreeNodeSerializerPrototype.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.javav2.dom.codec.generator.impl;
9
10 import com.google.common.annotations.Beta;
11 import java.io.IOException;
12 import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
13 import org.opendaylight.mdsal.binding.javav2.spec.runtime.BindingStreamEventWriter;
14 import org.opendaylight.mdsal.binding.javav2.spec.runtime.TreeNodeSerializerImplementation;
15 import org.opendaylight.mdsal.binding.javav2.spec.runtime.TreeNodeSerializerRegistry;
16
17 /**
18  * Prototype of a TreeNodeSerializerImplementation. This is a template class, which the stream writer
19  * generator uses to instantiate {@link TreeNodeSerializerImplementation} on a per-type basis. During that
20  * time, the {@link #serialize(TreeNodeSerializerRegistry, TreeNode, BindingStreamEventWriter)} method will be
21  * replaced by the real implementation.
22  */
23 @Beta
24 public final class TreeNodeSerializerPrototype implements TreeNodeSerializerImplementation {
25
26     private static final TreeNodeSerializerPrototype INSTANCE = new TreeNodeSerializerPrototype();
27
28     private TreeNodeSerializerPrototype() {
29         // Intentionally hidden, subclasses can replace it
30     }
31
32     /**
33      * Return the shared serializer instance.
34      *
35      * @return Global singleton instance.
36      */
37     public static TreeNodeSerializerPrototype getInstance() {
38         return INSTANCE;
39     }
40
41     @Override
42     public void serialize(final TreeNodeSerializerRegistry reg, final TreeNode obj,
43             final BindingStreamEventWriter stream) throws IOException {
44         throw new UnsupportedOperationException("Prototype body, this code should never be invoked.");
45     }
46
47 }