Class SupplyKeyMatchingValueOrNull<K,​V>

  • All Implemented Interfaces:
    com.google.common.base.Supplier<K>, Supplier<K>
    Direct Known Subclasses:
    GetRegionIdMatchingProviderURIOrNull

    public class SupplyKeyMatchingValueOrNull<K,​V>
    extends Object
    implements com.google.common.base.Supplier<K>
    Allows you to lazy discover a key by value. This is useful for example in service discovery, where you need to see what the "current" service name is based on a map of service names to endpoints.

    note

    take care to memoize this using Suppliers.memoize(Supplier)
    • Field Detail

      • logger

        protected Logger logger
    • Constructor Detail

      • SupplyKeyMatchingValueOrNull

        public SupplyKeyMatchingValueOrNull​(com.google.common.base.Supplier<Map<K,​com.google.common.base.Supplier<V>>> supplier,
                                            com.google.common.base.Supplier<V> valueSupplier)
    • Method Detail

      • get

        public K get()
        Specified by:
        get in interface com.google.common.base.Supplier<K>
        Specified by:
        get in interface Supplier<K>