X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=bgp%2Frib-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FRIBSupportContextRegistryImpl.java;h=d145a3060cc53856cd2d780ce02a0a171f9785b2;hb=343d29f5877e07429940c965c1067a03cbac0a47;hp=b96c90d7c0a928c7d10ad5e5cd9592e9c2c40068;hpb=d22e3bf8f0c73b6f8e3b4bff0c59ee6d05917970;p=bgpcep.git diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBSupportContextRegistryImpl.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBSupportContextRegistryImpl.java index b96c90d7c0..d145a3060c 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBSupportContextRegistryImpl.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBSupportContextRegistryImpl.java @@ -17,24 +17,22 @@ import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext; import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry; import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext; import org.opendaylight.protocol.bgp.rib.spi.RIBSupport; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes; import org.opendaylight.yangtools.yang.binding.ChildOf; import org.opendaylight.yangtools.yang.binding.ChoiceIn; import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.Identifiable; -import org.opendaylight.yangtools.yang.binding.Identifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; final class RIBSupportContextRegistryImpl implements RIBSupportContextRegistry { private final RIBExtensionConsumerContext extensionContext; private final CodecsRegistry codecs; - private final LoadingCache, RIBSupportContextImpl> contexts = CacheBuilder.newBuilder() - .build(new CacheLoader, RIBSupportContextImpl>() { + private final LoadingCache, RIBSupportContextImpl> contexts = CacheBuilder.newBuilder() + .build(new CacheLoader, RIBSupportContextImpl>() { @Override - public RIBSupportContextImpl load(final RIBSupport key) { + public RIBSupportContextImpl load(final RIBSupport key) { return createRIBSupportContext(key); } }); @@ -44,31 +42,31 @@ final class RIBSupportContextRegistryImpl implements RIBSupportContextRegistry { this.codecs = requireNonNull(codecs); } - static RIBSupportContextRegistryImpl create(final RIBExtensionConsumerContext extensions, final CodecsRegistry codecs) { + static RIBSupportContextRegistryImpl create(final RIBExtensionConsumerContext extensions, + final CodecsRegistry codecs) { return new RIBSupportContextRegistryImpl(extensions, codecs); } - private RIBSupportContextImpl createRIBSupportContext(final RIBSupport support) { + private RIBSupportContextImpl createRIBSupportContext(final RIBSupport support) { return new RIBSupportContextImpl(support, this.codecs); } @Override - public , S extends ChildOf, - R extends Route & ChildOf & Identifiable, I extends Identifier> - RIBSupport getRIBSupport(final TablesKey key) { + public , S extends ChildOf> + RIBSupport getRIBSupport(final TablesKey key) { final RIBSupportContext ribSupport = getRIBSupportContext(key); - if (ribSupport != null) { - return ribSupport.getRibSupport(); - } - return null; + return ribSupport == null ? null : ribSupport.getRibSupport(); } @Override public RIBSupportContext getRIBSupportContext(final TablesKey key) { - final RIBSupport ribSupport = this.extensionContext.getRIBSupport(key); - if (ribSupport != null) { - return this.contexts.getUnchecked(ribSupport); - } - return null; + final RIBSupport ribSupport = this.extensionContext.getRIBSupport(key); + return ribSupport == null ? null : this.contexts.getUnchecked(ribSupport); + } + + @Override + public RIBSupportContext getRIBSupportContext(final NodeIdentifierWithPredicates key) { + final RIBSupport ribSupport = this.extensionContext.getRIBSupport(key); + return ribSupport == null ? null : this.contexts.getUnchecked(ribSupport); } }