Revert "Add DataObjectUtils" 17/77617/11
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Nov 2018 09:49:32 +0000 (10:49 +0100)
committerJie Han <han.jie@zte.com.cn>
Tue, 13 Nov 2018 00:35:14 +0000 (00:35 +0000)
This reverts commit 0ef76ead8ed2d4af93e0d8cac92b67d087354057 in
preparation for a more proper solution.

JIRA: MDSAL-18
Change-Id: I96b89867e5a324327eb77cdde018700456fc4bbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 files changed:
binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtil.java [moved from binding/yang-binding/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtil.java with 100% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/FooChild.java [deleted file]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/GroupingFoo.java [deleted file]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtilTest.java [moved from binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtilTest.java with 100% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/FooChild.java [moved from binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/FooChild.java with 100% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/GroupingFoo.java [moved from binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/GroupingFoo.java with 100% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Node.java [moved from binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/Node.java with 100% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/NodeKey.java [moved from binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/NodeKey.java with 100% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Nodes.java [moved from binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/Nodes.java with 100% similarity]
binding/yang-binding/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectUtils.java [deleted file]
binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/DataObjectUtilsTest.java [deleted file]

index bfeba408aab20f5fe966c791f67940dfa30aa0ad..9f473a7758425b093eb7d5b289baa4613840f50d 100644 (file)
@@ -21,6 +21,8 @@ import java.lang.reflect.InvocationTargetException;
 import java.util.Collections;
 import java.util.List;
 import org.junit.Test;
+import org.opendaylight.mdsal.binding.spec.util.FooChild;
+import org.opendaylight.mdsal.binding.spec.util.GroupingFoo;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
diff --git a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/FooChild.java b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/FooChild.java
deleted file mode 100644 (file)
index 423fe82..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. 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.spec.reflect;
-
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-
-public interface FooChild extends ChildOf<GroupingFoo> {
-
-}
diff --git a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/GroupingFoo.java b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/GroupingFoo.java
deleted file mode 100644 (file)
index b2915fa..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. 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.spec.reflect;
-
-public interface GroupingFoo {
-
-}
diff --git a/binding/yang-binding/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectUtils.java b/binding/yang-binding/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectUtils.java
deleted file mode 100644 (file)
index 75edc69..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2018 Pantheon Technologies, s.r.o.  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.spec.util;
-
-import com.google.common.collect.ImmutableList;
-import java.util.List;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Various utility methods for bridging generated interfaces and human-written code. Methods in this class should be
- * statically imported into user code, so that the resulting code is expressive:
- *
- * <code>
- * import static org.opendaylight.yangtools.yang.binding.DataObjectUtils.nullToEmpty;
- *
- * FooWithList foo;
- * for (ListItem item : nulltoEmpty(foo.getList())) {
- *     // ..
- * }
- * </code>
- *
- * @author Robert Varga
- */
-@NonNullByDefault
-public final class DataObjectUtils {
-    private DataObjectUtils() {
-
-    }
-
-    /**
-     * Utility method for dealing with nullable Lists returned from Binding DTOs.
-     *
-     * @param input input list, may be null
-     * @return Input list or an empty list.
-     */
-    public static <T> List<T> nullToEmpty(final @Nullable List<T> input) {
-        return input != null ? input : ImmutableList.of();
-    }
-}
diff --git a/binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/DataObjectUtilsTest.java b/binding/yang-binding/src/test/java/org/opendaylight/mdsal/binding/spec/util/DataObjectUtilsTest.java
deleted file mode 100644 (file)
index b323115..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018 Pantheon Technologies, s.r.o.  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.spec.util;
-import static org.junit.Assert.assertSame;
-import static org.opendaylight.mdsal.binding.spec.util.DataObjectUtils.nullToEmpty;
-
-import com.google.common.collect.ImmutableList;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Test;
-
-public class DataObjectUtilsTest {
-    @Test
-    public void nullToEmptyNullTest() {
-        assertSame(ImmutableList.of(), nullToEmpty(null));
-    }
-
-    @Test
-    public void nullToEmptyNonNullTest() {
-        final List<Object> list = Collections.singletonList(null);
-        assertSame(list, nullToEmpty(list));
-    }
-}