@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,
MyCloudInvocationSuccess#getMethod; in the example above,
getKeyPairExtensionForRegionInvocationSuccess#getArgs; for example NorthInvocationSuccess#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 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-2016 The Apache Software Foundation. All Rights Reserved.