Do not use BindingReflections to acquire augmentations
[mdsal.git] / binding / mdsal-binding-spec-util / src / main / java / org / opendaylight / mdsal / binding / spec / reflect / BindingReflections.java
index f77cb5ff60a637b51c49ef281da0b956a411607d..ef55504e52957f0e39a3dcbe4d70b6e4ecd67dbe 100644 (file)
@@ -438,19 +438,24 @@ public final class BindingReflections {
     /**
      * Scans supplied class and returns an iterable of all data children classes.
      *
-     * @param type
-     *            YANG Modeled Entity derived from DataContainer
+     * @param type YANG Modeled Entity derived from DataContainer
      * @return Iterable of all data children, which have YANG modeled entity
      */
-    public static Map<Class<?>, Method> getChildrenClassToMethod(final Class<?> type) {
-        return getChildrenClassToMethod(type, BindingMapping.GETTER_PREFIX);
+    public static Map<Class<? extends DataContainer>, Method> getChildrenClassToMethod(final Class<?> type) {
+        return getChildClassToMethod(type, BindingMapping.GETTER_PREFIX);
+    }
+
+    @Beta
+    public static Map<Class<? extends DataContainer>, Method> getChildrenClassToNonnullMethod(final Class<?> type) {
+        return getChildClassToMethod(type, BindingMapping.NONNULL_PREFIX);
     }
 
-    private static Map<Class<?>, Method> getChildrenClassToMethod(final Class<?> type, final String prefix) {
+    private static Map<Class<? extends DataContainer>, Method> getChildClassToMethod(final Class<?> type,
+            final String prefix) {
         checkArgument(type != null, "Target type must not be null");
         checkArgument(DataContainer.class.isAssignableFrom(type), "Supplied type %s must be derived from DataContainer",
             type);
-        Map<Class<?>, Method> ret = new HashMap<>();
+        Map<Class<? extends DataContainer>, Method> ret = new HashMap<>();
         for (Method method : type.getMethods()) {
             Optional<Class<? extends DataContainer>> entity = getYangModeledReturnType(method, prefix);
             if (entity.isPresent()) {
@@ -460,11 +465,6 @@ public final class BindingReflections {
         return ret;
     }
 
-    @Beta
-    public static Map<Class<?>, Method> getChildrenClassToNonnullMethod(final Class<?> type) {
-        return getChildrenClassToMethod(type, BindingMapping.NONNULL_PREFIX);
-    }
-
     private static Optional<Class<? extends DataContainer>> getYangModeledReturnType(final Method method,
             final String prefix) {
         final String methodName = method.getName();
@@ -599,19 +599,6 @@ public final class BindingReflections {
         }
     }
 
-    /**
-     * Extracts augmentation from Binding DTO field using reflection.
-     *
-     * @param input Instance of DataObject which is augmentable and may contain augmentation
-     * @return Map of augmentations if read was successful, otherwise empty map.
-     * @deprecated Use {@link Augmentable#augmentations()} instead.
-     */
-    @SuppressWarnings("unchecked")
-    @Deprecated(forRemoval = true)
-    public static Map<Class<? extends Augmentation<?>>, Augmentation<?>> getAugmentations(final Augmentable<?> input) {
-        return (Map) input.augmentations();
-    }
-
     /**
      * Determines if two augmentation classes or case classes represents same
      * data.