Remove binding spec2
[mdsal.git] / binding2 / mdsal-binding2-dom-codec / src / main / java / org / opendaylight / mdsal / binding / javav2 / dom / codec / impl / context / ListNodeCodecContext.java
diff --git a/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/context/ListNodeCodecContext.java b/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/context/ListNodeCodecContext.java
deleted file mode 100644 (file)
index e98ab26..0000000
+++ /dev/null
@@ -1,94 +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.context;
-
-import com.google.common.annotations.Beta;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.mdsal.binding.javav2.dom.codec.impl.context.base.DataContainerCodecPrototype;
-import org.opendaylight.mdsal.binding.javav2.dom.codec.impl.context.base.TreeNodeCodecContext;
-import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-
-/**
- * Codec context for serializing and deserializing list node.
- *
- * @param <D>
- *            - type of tree node
- */
-@Beta
-public class ListNodeCodecContext<D extends TreeNode> extends TreeNodeCodecContext<D, ListSchemaNode> {
-
-    /**
-     * Prepare context for list node from prototype.
-     *
-     * @param prototype
-     *            - codec prototype of list node
-     */
-    public ListNodeCodecContext(final DataContainerCodecPrototype<ListSchemaNode> prototype) {
-        super(prototype);
-    }
-
-    @Nonnull
-    @Override
-    public D deserialize(@Nonnull final NormalizedNode<?, ?> node) {
-        if (node instanceof MapEntryNode) {
-            return fromMapEntry((MapEntryNode) node);
-        } else if (node instanceof UnkeyedListEntryNode) {
-            return fromUnkeyedListEntry((UnkeyedListEntryNode) node);
-        } else {
-            throw new IllegalStateException("Unsupported data type " + node.getClass());
-        }
-    }
-
-    @Override
-    protected Object deserializeObject(final NormalizedNode<?, ?> node) {
-        if (node instanceof MapNode) {
-            return fromMap((MapNode) node);
-        } else if (node instanceof MapEntryNode) {
-            return fromMapEntry((MapEntryNode) node);
-        } else if (node instanceof UnkeyedListNode) {
-            return fromUnkeyedList((UnkeyedListNode) node);
-        } else if (node instanceof UnkeyedListEntryNode) {
-            return fromUnkeyedListEntry((UnkeyedListEntryNode) node);
-        } else {
-            throw new IllegalStateException("Unsupported data type " + node.getClass());
-        }
-    }
-
-    private List<D> fromMap(final MapNode nodes) {
-        final List<D> ret = new ArrayList<>(nodes.getValue().size());
-        for (final MapEntryNode node : nodes.getValue()) {
-            ret.add(fromMapEntry(node));
-        }
-        return ret;
-    }
-
-    private D fromMapEntry(final MapEntryNode node) {
-        return createBindingProxy(node);
-    }
-
-    private D fromUnkeyedListEntry(final UnkeyedListEntryNode node) {
-        return createBindingProxy(node);
-    }
-
-    private List<D> fromUnkeyedList(final UnkeyedListNode nodes) {
-        // FIXME: Could be this lazy transformed list?
-        final List<D> ret = new ArrayList<>(nodes.getValue().size());
-        for (final UnkeyedListEntryNode node : nodes.getValue()) {
-            ret.add(fromUnkeyedListEntry(node));
-        }
-        return ret;
-    }
-}
\ No newline at end of file