de.smartics.util.adapt
Interface Adaptable


public interface Adaptable

Implemented by a class to support different adapters to its instances.


Method Summary
<T> T
as(Class<? extends T> type)
          Returns the adapter of the requested type.
 boolean isAdaptable(Class<?> type)
          Checks if the instance provides an adapter for the desired type.
 

Method Detail

as

<T> T as(Class<? extends T> type)
     throws AdaptableException
Returns the adapter of the requested type.

Type Parameters:
T - the type of the requested adapter.
Parameters:
type - the type of the requested adapter.
Returns:
the adapter instance of the requested type
Throws:
AdaptableException - if this instance does not provide an adapter of the requested type.

isAdaptable

boolean isAdaptable(Class<?> type)
Checks if the instance provides an adapter for the desired type.

Parameters:
type - the type of the requested adapter.
Returns:
true if the instance provides the requested adapter, false otherwise.


Copyright © 2011–2013 smartics. All rights reserved.