Interface As

  • All Known Implementing Classes:
    AsSupport

    public interface As
    Objects implementing this interface can provide am adapter of the required type. The adapter can be found with a variety of approaches that depend on the implementation. This capability can be used to implement a design based on the Data, Context and Interaction pattern (DCI).
    Version:
    $Id$
    Author:
    Fabrizio Giudici
    Status: stable API
    • Method Detail

      • as

        @Nonnull
        <T> T as​(@Nonnull
                 Class<T> type)
        Returns an adapter to this object of the specified type. If the implementation can find multiple compliant adapters, only one will be returned.
        Returns:
        the adapter
        Throws:
        AsException - if no adapter is found
      • as

        @Nonnull
        <T> T as​(@Nonnull
                 Class<T> type,
                 @Nonnull
                 As.NotFoundBehaviour<T> notFoundBehaviour)
        Returns an adapter to this object of the specified type. If the implementation can find multiple compliant adapters, only one will be returned. If no adapter is found, the result provided by the given default behaviour will be returned.
        Parameters:
        notFoundBehaviour - the behaviour to apply when an adapter is not found
      • asMany

        @Nonnull
        <T> Collection<T> asMany​(@Nonnull
                                 Class<T> type)
        Searches for multiple adapters of the given type and returns them.
        Parameters:
        type - the adapter type
        Returns:
        a collection of adapters, possibly empty