Interface AdapterFactory

All Known Implementing Classes:
AdapterFactoryImpl

public interface AdapterFactory
A factory for creating adapters and associating them with notifiers. An implementation may choose to associate one adapter with multiple notifiers.
  • Method Summary

    Modifier and Type
    Method
    Description
    adapt(Object object, Object type)
    Returns either an associated adapter for the object, or the object itself, depending on whether the object is a notifier that supports an adapter of the given type.
    adapt(Notifier target, Object type)
    Returns either a previously associated adapter or a newly associated adapter, as appropriate.
    void
    Creates a new associated adapter of each type of adapter supported by this factory, as necessary.
    adaptNew(Notifier target, Object type)
    Creates a new associated adapter of the given type; it may optionally call setTarget on the adapter, and it may optionally add the adapter to the target.eAdapters().
    boolean
    Returns whether this factory supports adapters for the given type.
  • Method Details

    • isFactoryForType

      boolean isFactoryForType(Object type)
      Returns whether this factory supports adapters for the given type.
      Parameters:
      type - the key indicating the type of adapter in question.
      Returns:
      whether this factory supports adapters for the given type.
      See Also:
    • adapt

      Object adapt(Object object, Object type)
      Returns either an associated adapter for the object, or the object itself, depending on whether the object is a notifier that supports an adapter of the given type. This is essentially just a convenience method that allows a factory to act as a filter for converting objects to adapters. If the type isn't supported or the specific object can't be adapted to it, null will typically be returned.
      Parameters:
      object - arbitrary object to adapt.
      type - the key indicating the type of adapter required.
      Returns:
      either an associated adapter, the object itself, or null if the type isn't supported or the object cannot be adapted to it.
    • adapt

      Adapter adapt(Notifier target, Object type)
      Returns either a previously associated adapter or a newly associated adapter, as appropriate. It will check if the right type of adapter is already associated with the target and will return it in that case; otherwise, it will create a new adapter if possible.
      Parameters:
      target - the notifier to adapt.
      type - the key indicating the type of adapter required.
      Returns:
      a previously existing associated adapter, a new associated adapter if possible, or null otherwise.
      See Also:
    • adaptNew

      Adapter adaptNew(Notifier target, Object type)
      Creates a new associated adapter of the given type; it may optionally call setTarget on the adapter, and it may optionally add the adapter to the target.eAdapters(). This is typically not called directly by clients.
      Parameters:
      target - the notifier to adapt.
      type - the key indicating the type of adapter required.
      Returns:
      a new associated adapter if possible, or null otherwise.
      See Also:
    • adaptAllNew

      void adaptAllNew(Notifier notifier)
      Creates a new associated adapter of each type of adapter supported by this factory, as necessary. This is typically used to adapt newly created objects.
      Parameters:
      notifier - notifier to adapt.
      See Also: