@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,
MyCloud
ClassMethodArgs.getMethod()
; in the example above,
getKeyPairExtensionForRegion
ClassMethodArgs.getArgs()
; for example North
ClassMethodArgsAndReturnVal.getReturnVal()
; in the example
above, an implementation of KeyPairClient
ImplicitOptionalConverter
can perform whatever you need, when deciding if the the returnVal is present
and available. Here are some ideas:
default implementation
returns present if no SinceApiVersion
annotation is assigned, or the value is less than or equal to the current
ApiVersion
. To override this, add the following in your subclass
override of RestClientModule.configure()
method:
bind(ImplicitOptionalConverter.class).to(MyCustomOptionalConverter.class);
Copyright © 2009-2013 jclouds. All Rights Reserved.