Package org.jclouds.rest.functions
Interface ImplicitOptionalConverter
- All Superinterfaces:
com.google.common.base.Function<InvocationSuccess,
,com.google.common.base.Optional<Object>> Function<InvocationSuccess,
com.google.common.base.Optional<Object>>
- All Known Implementing Classes:
AlwaysPresentImplicitOptionalConverter
,PresentWhenApiVersionLexicographicallyAtOrAfterSinceApiVersion
,PresentWhenExtensionAnnotationMatchesExtensionSet
@Beta
public interface ImplicitOptionalConverter
extends com.google.common.base.Function<InvocationSuccess,com.google.common.base.Optional<Object>>
When a client marked @Delegate is optional, the implementation of this is
responsible for creating the optional object.
For example.
annotation is assigned, or the value is less than or equal to the current
. To override this, add the following in your subclass
override of
method:
interface MyCloud { @Delegate Optional<KeyPairClient> getKeyPairExtensionForRegion(String region); }The input object of type
InvocationSuccess
will include the
following.
- the class declaring the method that returns optional:
invalid reference
InvocationSuccess#getClazz
MyCloud
- the method returning the optional:
invalid reference
InvocationSuccess#getMethod
getKeyPairExtensionForRegion
- the args passed to that method at runtime:
invalid reference
InvocationSuccess#getArgs
North
- the rest client to be enclosed in the optional, should you choose to
return it:
invalid reference
InvocationSuccess#getReturnVal
KeyPairClient
ImplicitOptionalConverter
can perform whatever you need, when deciding if the the returnVal is present
and available. Here are some ideas:
- call a smoke test command
- look at the annotations on the class and compare those against a configuration switch enabling the extension
- inspect the health of the client, perhaps looking for error status
- call another api which can validate the feature can be presented
default implementation
returns present if no
invalid reference
SinceApiVersion
invalid reference
ApiVersion
invalid reference
RestClientModule#configure
bind(ImplicitOptionalConverter.class).to(MyCustomOptionalConverter.class);
-
Method Summary
Methods inherited from interface com.google.common.base.Function
apply, equals