Package org.jclouds
Interface View
- All Known Subinterfaces:
AWSEC2ComputeServiceContext
,AWSS3BlobStoreContext
,BlobStoreContext
,CloudStackContext
,ComputeServiceContext
,EC2ComputeServiceContext
,LoadBalancerServiceContext
,S3BlobStoreContext
- All Known Implementing Classes:
AWSEC2ComputeServiceContextImpl
,AWSS3BlobStoreContextImpl
,BaseView
,BlobStoreContextImpl
,CloudStackContextImpl
,ComputeServiceContextImpl
,EC2ComputeServiceContextImpl
,LoadBalancerServiceContextImpl
,RegionScopedBlobStoreContext
,S3BlobStoreContextImpl
@Beta
public interface View
View
allows access to the provider-specific, or library-driven api
behind an abstraction. One backend context can support multiple views.
For example, the CloudStackContext
can be backend by both
ComputeServiceContext
and LoadBalancerServiceContext
, as the
api covers these features.-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.reflect.TypeToken
<?> <C extends Context>
Cunwrap()
shortcut forunwrap(getWrappedType())
<C extends Context>
Cunwrap
(com.google.common.reflect.TypeToken<C> type) Return an object of the specified type to allow access to the backend context.<A extends Closeable>
AUnwraps the underlying api from this view.
-
Method Details
-
getBackendType
com.google.common.reflect.TypeToken<?> getBackendType()- Returns:
- type of the context powering the current one.
-
unwrap
<C extends Context> C unwrap(com.google.common.reflect.TypeToken<C> type) throws IllegalArgumentException Return an object of the specified type to allow access to the backend context. If the backend context is not assignable from the supplied type, anIllegalArgumentException
is thrown. ex.ApiContext
backendApi = computeContext.unwrap(new TypeTokeninvalid input: '<'ApiContext >(){}); - Parameters:
type
- the type of the context to be returned. The backend context must be assignable from this type.- Returns:
- an instance of the specified type
- Throws:
IllegalArgumentException
- if the backend context is not assignable from the specified class.- See Also:
-
unwrap
shortcut forunwrap(getWrappedType())
- Throws:
ClassCastException
- if the user suppliedC
param is not assignableFromgetBackendType()
-
unwrapApi
Unwraps the underlying api from this view.- Parameters:
apiClass
- The class of the api to unwrap.- Returns:
- The unwrapped api.
- Since:
- 1.7
-