org.jclouds.internal
Class BaseView

java.lang.Object
  extended by com.google.common.collect.ForwardingObject
      extended by org.jclouds.internal.BaseView
All Implemented Interfaces:
View

@Singleton
public abstract class BaseView
extends com.google.common.collect.ForwardingObject
implements View

Author:
Adrian Cole

Constructor Summary
protected BaseView(Context backend, com.google.common.reflect.TypeToken<? extends Context> backendType)
           
 
Method Summary
protected  Context delegate()
           
 boolean equals(Object o)
           
 com.google.common.reflect.TypeToken<? extends Context> getBackendType()
           
 int hashCode()
           
protected  com.google.common.base.Objects.ToStringHelper string()
           
 String toString()
           
<C extends Context>
C
unwrap()
          shortcut for unwrap(getWrappedType())
<C extends Context>
C
unwrap(Class<C> clazz)
          shortcut for unwrap(TypeToken.of(clazz))
<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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseView

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

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.
 RestContext backendApi = computeContext.unwrap(NovaApiMetadata.CONTEXT_TOKEN);
 

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

unwrap

public <C extends Context> C unwrap(Class<C> clazz)
Description copied from interface: View
shortcut for unwrap(TypeToken.of(clazz))

Specified by:
unwrap in interface View
See Also:
View.unwrap(TypeToken)

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

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.Objects.ToStringHelper string()


Copyright © 2009-2013 jclouds. All Rights Reserved.