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
  • Constructor Details

    • BaseView

      protected BaseView(Context backend, com.google.common.reflect.TypeToken<? extends Context> backendType)
  • Method Details

    • unwrap

      public <C extends Context> C unwrap(com.google.common.reflect.TypeToken<C> type)
      Description copied from interface: View
      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.
       ApiContext backendApi = computeContext.unwrap(new TypeTokeninvalid input: '<'ApiContext>(){});
       
      Specified by:
      unwrap in interface View
      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:
    • getBackendType

      public com.google.common.reflect.TypeToken<? extends Context> getBackendType()
      Specified by:
      getBackendType in interface View
      Returns:
      type of the context powering the current one.
    • unwrap

      public <C extends Context> C unwrap() throws ClassCastException
      Description copied from interface: View
      shortcut for unwrap(getWrappedType())
      Specified by:
      unwrap in interface View
      Throws:
      ClassCastException - if the user supplied C param is not assignableFrom View.getBackendType()
    • unwrapApi

      public <A extends Closeable> A unwrapApi(Class<A> apiClass)
      Description copied from interface: View
      Unwraps the underlying api from this view.
      Specified by:
      unwrapApi in interface View
      Parameters:
      apiClass - The class of the api to unwrap.
      Returns:
      The unwrapped api.
    • delegate

      protected Context delegate()
      Specified by:
      delegate in class com.google.common.collect.ForwardingObject
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class com.google.common.collect.ForwardingObject
    • string

      protected com.google.common.base.MoreObjects.ToStringHelper string()