X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-generator%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fgenerator%2Fimpl%2Freactor%2FLeafListGenerator.java;h=aa6263a192696b724237e364020118151b64c883;hb=0ee55d1f9da11dd03ff05fc67d10cbcbfe63fd2c;hp=eb9b36ebf074e7fda50fc9e895060446b030ab31;hpb=89a12a10b9573dcc84a5636c046cbd0610bc2111;p=mdsal.git diff --git a/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/LeafListGenerator.java b/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/LeafListGenerator.java index eb9b36ebf0..aa6263a192 100644 --- a/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/LeafListGenerator.java +++ b/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/LeafListGenerator.java @@ -7,15 +7,19 @@ */ package org.opendaylight.mdsal.binding.generator.impl.reactor; +import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultLeafListRuntimeType; import org.opendaylight.mdsal.binding.model.api.Type; import org.opendaylight.mdsal.binding.model.ri.Types; +import org.opendaylight.mdsal.binding.runtime.api.LeafListRuntimeType; +import org.opendaylight.yangtools.yang.common.Ordering; import org.opendaylight.yangtools.yang.model.api.stmt.LeafListEffectiveStatement; /** * Generator corresponding to a {@code leaf-list} statement. */ -final class LeafListGenerator extends AbstractTypeAwareGenerator { - LeafListGenerator(final LeafListEffectiveStatement statement, final AbstractCompositeGenerator parent) { +final class LeafListGenerator + extends AbstractTypeAwareGenerator { + LeafListGenerator(final LeafListEffectiveStatement statement, final AbstractCompositeGenerator parent) { super(statement, parent); } @@ -24,6 +28,22 @@ final class LeafListGenerator extends AbstractTypeAwareGenerator, we will try to narrow the return type in subclasses. final Type type = super.methodReturnType(builderFactory); - return Types.objectType().equals(type) ? Types.listTypeWildcard() : Types.listTypeFor(type); + final boolean isObject = Types.objectType().equals(type); + + if (statement().ordering() == Ordering.SYSTEM) { + return isObject ? Types.setTypeWildcard() : Types.setTypeFor(type); + } + return isObject ? Types.listTypeWildcard() : Types.listTypeFor(type); + } + + @Override + LeafListRuntimeType createExternalRuntimeType(final Type type) { + return new DefaultLeafListRuntimeType(type, statement()); + } + + @Override + LeafListRuntimeType createInternalRuntimeType(final ChildLookup lookup, final LeafListEffectiveStatement statement, + final Type type) { + return new DefaultLeafListRuntimeType(type, statement); } }