Remove GeneratorUtil.getTopParentTransportObject() 96/91296/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 13 Jul 2020 11:12:34 +0000 (13:12 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 13 Jul 2020 11:13:03 +0000 (13:13 +0200)
This method is not used anywhere and is quite inefficient, remove
it.

Change-Id: I3d381793c6c20fb056d03118b942a2257756a4bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/GeneratorUtil.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/GeneratorUtilTest.java

index 846af7306cef0443935232fe12aa0ba62686f11f..d8bc7ac5b5d0dd9848395d0e6df73eed799edd80 100644 (file)
@@ -285,26 +285,6 @@ public final class GeneratorUtil {
         return builder.toString();
     }
 
-    /**
-     * Returns the reference to highest (top parent) Generated Transfer Object.
-     *
-     * @param childTransportObject is generated transfer object which can be extended by other generated transfer object
-     * @return in first case that <code>childTransportObject</code> is not extended then
-     *         <code>childTransportObject</code> is returned. In second case the method is recursive called until first
-     *         case.
-     * @throws IllegalArgumentException if <code>childTransportObject</code> equals <code>null</code>
-     */
-    static GeneratedTransferObject getTopParentTransportObject(final GeneratedTransferObject childTransportObject) {
-        if (childTransportObject == null) {
-            throw new IllegalArgumentException("Parameter childTransportObject can't be null.");
-        }
-        if (childTransportObject.getSuperType() == null) {
-            return childTransportObject;
-        }
-
-        return getTopParentTransportObject(childTransportObject.getSuperType());
-    }
-
     /**
      * Selects from input list of properties only those which have read only attribute set to true.
      *
index 14690b52208caac5e2d9b20d8f865456f783d5d5..0a0ee79cedaa3b090428fc2cb88febd6202f9995 100644 (file)
@@ -148,18 +148,4 @@ public class GeneratorUtilTest {
                 createImports(generatedType)).contains(parameterizedType.getName()));
 
     }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void getTopParentTransportObjectWithExceptionTest() throws Exception {
-        GeneratorUtil.getTopParentTransportObject(null);
-    }
-
-    @Test
-    public void getTopParentTransportObjectTest() throws Exception {
-        assertEquals(enclosedType, GeneratorUtil.getTopParentTransportObject(enclosedType));
-
-        final GeneratedTransferObject parent = mock(GeneratedTransferObject.class);
-        doReturn(parent).when(enclosedType).getSuperType();
-        assertEquals(parent, GeneratorUtil.getTopParentTransportObject(enclosedType));
-    }
 }
\ No newline at end of file