org.jclouds
Interface View

All Known Implementing Classes:
BaseView

@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.

Author:
Adrian Cole

Method Summary
 com.google.common.reflect.TypeToken<?> getBackendType()
           
<C extends Context>
C
unwrap()
          shortcut for unwrap(getWrappedType())
<C extends Context>
C
unwrap(com.google.common.reflect.TypeToken<C> type)
          Return an object of the specified type to allow access to the backend context.
 

Method Detail

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, an IllegalArgumentException is thrown. ex.
 RestContext backendApi = computeContext.unwrap(NovaApiMetadata.CONTEXT_TOKEN);
 

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:
getBackendType()

unwrap

<C extends Context> C unwrap()
                         throws ClassCastException
shortcut for unwrap(getWrappedType())

Throws:
ClassCastException - if the user supplied C param is not assignableFrom getBackendType()


Copyright © 2009-2013 jclouds. All Rights Reserved.