Remove binding spec2
[mdsal.git] / binding2 / mdsal-binding2-dom-codec / src / main / java / org / opendaylight / mdsal / binding / javav2 / dom / codec / impl / serializer / ChoiceDispatchSerializer.java
diff --git a/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/serializer/ChoiceDispatchSerializer.java b/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/serializer/ChoiceDispatchSerializer.java
deleted file mode 100644 (file)
index 9605fa3..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.binding.javav2.dom.codec.impl.serializer;
-
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.annotations.Beta;
-import java.io.IOException;
-import org.opendaylight.mdsal.binding.javav2.spec.base.Instantiable;
-import org.opendaylight.mdsal.binding.javav2.spec.base.Item;
-import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
-import org.opendaylight.mdsal.binding.javav2.spec.runtime.BindingStreamEventWriter;
-import org.opendaylight.mdsal.binding.javav2.spec.runtime.TreeNodeSerializer;
-import org.opendaylight.mdsal.binding.javav2.spec.runtime.TreeNodeSerializerImplementation;
-import org.opendaylight.mdsal.binding.javav2.spec.runtime.TreeNodeSerializerRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Dispatch serializer, which emit DOM data from Binding v2 via stream writer.
- */
-@Beta
-public final class ChoiceDispatchSerializer implements TreeNodeSerializerImplementation {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ChoiceDispatchSerializer.class);
-
-    @SuppressWarnings("rawtypes")
-    private final Class choiceClass;
-
-    @SuppressWarnings("rawtypes")
-    private ChoiceDispatchSerializer(final Class choiceClass) {
-        this.choiceClass = requireNonNull(choiceClass);
-    }
-
-    /**
-     * Prepare instance of serializer from choice class.
-     *
-     * @param choiceClass
-     *            - class choice
-     * @return instance of serializer
-     */
-    public static ChoiceDispatchSerializer from(final Class<? extends Instantiable<?>> choiceClass) {
-        return new ChoiceDispatchSerializer(choiceClass);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public void serialize(final TreeNodeSerializerRegistry reg, final TreeNode obj,
-            final BindingStreamEventWriter stream) throws IOException {
-        @SuppressWarnings("rawtypes")
-        final Class cazeClass = ((Instantiable<?>) obj).implementedInterface();
-        stream.startChoiceNode(new Item<>(choiceClass), BindingStreamEventWriter.UNKNOWN_SIZE);
-        final TreeNodeSerializer caseSerializer = reg.getSerializer(cazeClass);
-        if (caseSerializer != null) {
-            caseSerializer.serialize(obj, stream);
-        } else {
-            LOG.warn("No serializer for case {} is available in registry {}", cazeClass, reg);
-        }
-        stream.endNode();
-    }
-}
\ No newline at end of file