org.jclouds.suppliers
Class SupplyKeyMatchingValueOrNull<K,V>
java.lang.Object
org.jclouds.suppliers.SupplyKeyMatchingValueOrNull<K,V>
- All Implemented Interfaces:
- com.google.common.base.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)
- Author:
- Adrian Cole
Constructor Summary |
SupplyKeyMatchingValueOrNull(com.google.common.base.Supplier<Map<K,com.google.common.base.Supplier<V>>> supplier,
com.google.common.base.Supplier<V> valueSupplier)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected Logger logger
SupplyKeyMatchingValueOrNull
public SupplyKeyMatchingValueOrNull(com.google.common.base.Supplier<Map<K,com.google.common.base.Supplier<V>>> supplier,
com.google.common.base.Supplier<V> valueSupplier)
get
public K get()
- Specified by:
get
in interface com.google.common.base.Supplier<K>
Copyright © 2009-2012 jclouds. All Rights Reserved.