@Beta public interface ImplicitOptionalConverter extends com.google.common.base.Function<InvocationSuccess,com.google.common.base.Optional<Object>>
interface MyCloud { @Delegate Optional<KeyPairClient> getKeyPairExtensionForRegion(String region); }The input object of type
InvocationSuccess
will include the
following.
InvocationSuccess#getClazz
; in the example above,
MyCloud
InvocationSuccess#getMethod
; in the example above,
getKeyPairExtensionForRegion
InvocationSuccess#getArgs
; for example North
InvocationSuccess#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-2014 The Apache Software Foundation. All Rights Reserved.