Package org.eclipse.gef.common.adapt
Class AdapterKey<T>
java.lang.Object
org.eclipse.gef.common.adapt.AdapterKey<T>
- Type Parameters:
- T- The type parameter corresponding to the type parameter of the- Classused as key (- getKey()).
- All Implemented Interfaces:
- Comparable<AdapterKey<T>>
A pair of 
Class key and String role to register adapters at
 and retrieve them from IAdaptables. Using an AdapterKey
 instead of just a Class or TypeToken key allows to register
 several adapters under the same key, serving different roles. Nevertheless,
 adapters can still be accessed in a type-safe manner. To register a default
 adapter for a certain Class or TypeToken key, the
 DEFAULT_ROLE may be used.
 
 Creating AdapterKeys is supported by get(Class, String) and
 get(TypeToken, String), as well as get(Class) and
 get(TypeToken) respectively, where the latter two will use the
 DEFAULT_ROLE.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionintcompareTo(AdapterKey<T> o) static AdapterKey<?>Returns anAdapterKeywith no type key and the 'default' role, which can only be used in adapter map bindings.booleanstatic <T> AdapterKey<T>Creates a newAdapterKeyfor the given type key and theDEFAULT_ROLErole, which can be used to retrieve an adapter from an IAdaptable.static <T> AdapterKey<T>Creates a newAdapterKeyfor the given key and role, which can be used to retrieve an adapter from an IAdaptable.static <T> AdapterKey<T>Creates a newAdapterKeyfor the given raw type key and theDEFAULT_ROLErole, which can be used to retrieve an adapter from an IAdaptable.static <T> AdapterKey<T>Creates a newAdapterKeyfor the given key and role.getKey()Returns the key used by thisAdapterKey.getRole()Returns the role used by thisAdapterKey.inthashCode()static AdapterKey<?>Returns anAdapterKeywith no type key and the given role, which can only be used in adapter map bindings.toString()
- 
Field Details- 
DEFAULT_ROLEA default role to be used forAdapterKeys.- See Also:
 
 
- 
- 
Method Details- 
defaultRoleReturns anAdapterKeywith no type key and the 'default' role, which can only be used in adapter map bindings. SeeAdapterMaps.- Returns:
- An AdapterKey without type key, using the 'default' role.
 
- 
getCreates a newAdapterKeyfor the given raw type key and theDEFAULT_ROLErole, which can be used to retrieve an adapter from an IAdaptable.- Type Parameters:
- T- The adapter type.
- Parameters:
- key- The key to use for the newly created- AdapterKey. May not be- null.
- Returns:
- A new AdapterKeyfor the given key and role.
- See Also:
 
- 
getCreates a newAdapterKeyfor the given key and role.- Type Parameters:
- T- The adapter type.
- Parameters:
- key- The key to use for the newly created- AdapterKey. May not be- null.
- role- The role to use for the newly created- AdapterKey. May not be- null.
- Returns:
- A new AdapterKeyfor the given key and role.
 
- 
getCreates a newAdapterKeyfor the given type key and theDEFAULT_ROLErole, which can be used to retrieve an adapter from an IAdaptable.- Type Parameters:
- T- The adapter type.
- Parameters:
- key- The key to use for the newly created- AdapterKey. May not be- null.
- Returns:
- A new AdapterKeyfor the given key and role.
- See Also:
 
- 
getCreates a newAdapterKeyfor the given key and role, which can be used to retrieve an adapter from an IAdaptable.- Type Parameters:
- T- The adapter type.
- Parameters:
- key- The key to use for the newly created- AdapterKey. May not be- null.
- role- The role to use for the newly created- AdapterKey. May not be- null.
- Returns:
- A new AdapterKeyfor the given key and role.
 
- 
roleReturns anAdapterKeywith no type key and the given role, which can only be used in adapter map bindings. SeeAdapterMaps.- Parameters:
- role- The role to use.
- Returns:
- An AdapterKey without type key, using the given role.
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<T>
 
- 
equals
- 
getKeyReturns the key used by thisAdapterKey.- Returns:
- The key being used.
 
- 
getRoleReturns the role used by thisAdapterKey.- Returns:
- The role being used.
 
- 
hashCodepublic int hashCode()
- 
toString
 
-