Fix actions in keyed lists
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / mdsal / binding / model / util / BindingTypes.java
index 5afd0cdcb6cbc9b10e8a7a05011f1a91ccd9dff4..117276462d717e86f55dc74f503f9d4a3570aab0 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.yangtools.yang.binding.DataRoot;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedListAction;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.opendaylight.yangtools.yang.binding.RpcInput;
@@ -64,6 +65,7 @@ public final class BindingTypes {
     private static final ConcreteType ACTION = typeForClass(Action.class);
     private static final ConcreteType CHILD_OF = typeForClass(ChildOf.class);
     private static final ConcreteType CHOICE_IN = typeForClass(ChoiceIn.class);
+    private static final ConcreteType KEYED_LIST_ACTION = typeForClass(KeyedListAction.class);
     private static final ConcreteType RPC_RESULT = typeForClass(RpcResult.class);
 
     private BindingTypes() {
@@ -80,7 +82,22 @@ public final class BindingTypes {
      * @throws NullPointerException if any argument is is null
      */
     public static ParameterizedType action(final Type parent, final Type input, final Type output) {
-        return parameterizedTypeFor(ACTION, parent, input, output);
+        return parameterizedTypeFor(ACTION, instanceIdentifier(parent), input, output);
+    }
+
+    /**
+     * Type specializing {@link KeyedListAction} for a particular type.
+     *
+     * @param parent Type of parent defining the action
+     * @param keyType Type of parent's key
+     * @param input Type input type
+     * @param output Type output type
+     * @return A parameterized type corresponding to {@code KeyedListAction<ParentKey, Parent, Input, Output>}
+     * @throws NullPointerException if any argument is is null
+     */
+    public static ParameterizedType keyedListAction(final Type parent, final Type keyType, final Type input,
+            final Type output) {
+        return parameterizedTypeFor(KEYED_LIST_ACTION, keyType, parent, input, output);
     }
 
     /**