public interface IAdapterSupport
This can be interpreted as a "dynamic" cast to a type that is not statically declared for the receiver. This pattern allows more freedom in layered / component oriented architectures, as the receiver object is not forced to implement a certain interface at compile time. Moreover, the "instanceof" predicate can be implemented on a per instance base.
A generic implementation of this method could use the IAdapterOutlet
singleton to delegate adapter creation to a registered
IAdapterFactory.
public <T> T getAdapter(Class<T> clazz) {
return AdapterOutlet.get().getAdapter(this, clazz);
}
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getAdapter(Class<T> clazz)
Return an object of type
clazz that represents the receiver. |
<T> T getAdapter(Class<T> clazz)
clazz that represents the receiver.
This method should return null if adaption is not possible.
T - clazz - clazz that represents the
receiver.Copyright © 2013 intarsys consulting GmbH. All Rights Reserved.