ActionSpec's generics fail to account for KeyedListActions. Fix that
by making sure allow for KeyedInstanceIdentifiers as well as
InstanceIdentifiers.
JIRA: MDSAL-721
Change-Id: I520e23e0294c38c37c6a15dd4d7f05c937476357
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
7c8af4914727a5343d0dfa2034e1f1c818ce6e35)
* @param <P> Action parent type
*/
@Beta
* @param <P> Action parent type
*/
@Beta
-public final class ActionSpec<A extends Action<InstanceIdentifier<P>, ?, ?>, P extends DataObject>
+public final class ActionSpec<A extends Action<? extends InstanceIdentifier<P>, ?, ?>, P extends DataObject>
implements Immutable {
private final @NonNull InstanceIdentifier<P> path;
private final @NonNull Class<A> type;
implements Immutable {
private final @NonNull InstanceIdentifier<P> path;
private final @NonNull Class<A> type;
- public <A extends Action<InstanceIdentifier<P>, ?, ?>> @NonNull ActionSpec<A, P> build(final Class<A> type) {
+ public <A extends Action<? extends InstanceIdentifier<P>, ?, ?>> @NonNull ActionSpec<A, P> build(
+ final Class<A> type) {
return new ActionSpec<>(type, pathBuilder.build());
}
return new ActionSpec<>(type, pathBuilder.build());
}
import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Cont;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Grpcont;
import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Cont;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Grpcont;
+import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Grplst;
+import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Lstio;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Nestedcont;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Othercont;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.cont.Foo;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.grpcont.Bar;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Nestedcont;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.Othercont;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.cont.Foo;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.grpcont.Bar;
+import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.lstio.Fooio;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.nested.Baz;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
import org.opendaylight.yang.gen.v1.urn.odl.actions.norev.nested.Baz;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
assertEquals(Absolute.of(Nestedcont.QNAME, Baz.QNAME, Bar.QNAME), codec.getActionPath(
ActionSpec.builder(Nestedcont.class).withPathChild(Baz.class).build(
org.opendaylight.yang.gen.v1.urn.odl.actions.norev.nested.baz.Bar.class)));
assertEquals(Absolute.of(Nestedcont.QNAME, Baz.QNAME, Bar.QNAME), codec.getActionPath(
ActionSpec.builder(Nestedcont.class).withPathChild(Baz.class).build(
org.opendaylight.yang.gen.v1.urn.odl.actions.norev.nested.baz.Bar.class)));
+ assertEquals(Absolute.of(Lstio.QNAME, Fooio.QNAME), codec.getActionPath(
+ ActionSpec.builder(Lstio.class).build(Fooio.class)));
+ assertEquals(Absolute.of(Grplst.QNAME, Bar.QNAME), codec.getActionPath(
+ ActionSpec.builder(Grplst.class).build(
+ org.opendaylight.yang.gen.v1.urn.odl.actions.norev.grplst.Bar.class)));