@Beta public interface ImplicitOptionalConverter extends com.google.common.base.Function<ClassMethodArgsAndReturnVal,com.google.common.base.Optional<Object>>
interface MyCloud {
@Delegate
Optional<KeyPairClient> getKeyPairExtensionForRegion(String region);
}
The input object of type ClassMethodArgsAndReturnVal will include the
following.
ClassMethodArgs.getClazz(); in the example above,
MyCloudClassMethodArgs.getMethod(); in the example above,
getKeyPairExtensionForRegionClassMethodArgs.getArgs(); for example NorthClassMethodArgsAndReturnVal.getReturnVal(); in the example
above, an implementation of KeyPairClientImplicitOptionalConverter
can perform whatever you need, when deciding if the the returnVal is present
and available. Here are some ideas:
default implementation
always returns present. To override this, add the following in your subclass
override of RestClientModule.configure() method:
bind(ImplicitOptionalConverter.class).to(MyCustomOptionalConverter.class);
Copyright © 2009-2012 jclouds. All Rights Reserved.