Interface IAdapterSupport

All Known Implementing Classes:
DelegatingLocator, LocatorByReference, LocatorViewport, ReadOnlyLocator

public interface IAdapterSupport
An object that is able to be adapted to another type.

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.

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);
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    getAdapter(Class<T> clazz)
    Return an object of type clazz that represents the receiver.
  • Method Details

    • getAdapter

      <T> T getAdapter(Class<T> clazz)
      Return an object of type clazz that represents the receiver.

      This method should return null if adaption is not possible.

      Type Parameters:
      T -
      Parameters:
      clazz -
      Returns:
      Return an object of type clazz that represents the receiver.