Package org.jclouds.internal
Class BaseView
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- org.jclouds.internal.BaseView
-
- All Implemented Interfaces:
View
- Direct Known Subclasses:
BlobStoreContextImpl,ComputeServiceContextImpl,LoadBalancerServiceContextImpl,RegionScopedBlobStoreContext
public abstract class BaseView extends com.google.common.collect.ForwardingObject implements View
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Contextdelegate()booleanequals(Object o)com.google.common.reflect.TypeToken<? extends Context>getBackendType()inthashCode()protected com.google.common.base.MoreObjects.ToStringHelperstring()StringtoString()<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>
AunwrapApi(Class<A> apiClass)Unwraps the underlying api from this view.
-
-
-
Method Detail
-
unwrap
public <C extends Context> C unwrap(com.google.common.reflect.TypeToken<C> type)
Description copied from interface:ViewReturn an object of the specified type to allow access to the backend context. If the backend context is not assignable from the supplied type, anIllegalArgumentExceptionis thrown. ex.ApiContext
backendApi = computeContext.unwrap(new TypeToken >(){}); - Specified by:
unwrapin interfaceView- 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
- See Also:
View.getBackendType()
-
getBackendType
public com.google.common.reflect.TypeToken<? extends Context> getBackendType()
- Specified by:
getBackendTypein interfaceView- Returns:
- type of the context powering the current one.
-
unwrap
public <C extends Context> C unwrap() throws ClassCastException
Description copied from interface:Viewshortcut forunwrap(getWrappedType())- Specified by:
unwrapin interfaceView- Throws:
ClassCastException- if the user suppliedCparam is not assignableFromView.getBackendType()
-
unwrapApi
public <A extends Closeable> A unwrapApi(Class<A> apiClass)
Description copied from interface:ViewUnwraps the underlying api from this view.
-
delegate
protected Context delegate()
- Specified by:
delegatein classcom.google.common.collect.ForwardingObject
-
toString
public String toString()
- Overrides:
toStringin classcom.google.common.collect.ForwardingObject
-
string
protected com.google.common.base.MoreObjects.ToStringHelper string()
-
-