Package it.tidalwave.util
Interface As
-
- All Known Implementing Classes:
AsSupport
public interface AsObjects 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAs.Defaultsstatic interfaceAs.NotFoundBehaviour<T>
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tas(Class<T> type)Returns an adapter to this object of the specified type.<T> Tas(Class<T> type, As.NotFoundBehaviour<T> notFoundBehaviour)Returns an adapter to this object of the specified type.<T> Collection<T>asMany(Class<T> type)Searches for multiple adapters of the given type and returns them.
-
-
-
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
-
-