Package it.tidalwave.util.spi
Class AsSupport
- java.lang.Object
- 
- it.tidalwave.util.spi.AsSupport
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface it.tidalwave.util.AsAs.Defaults, As.NotFoundBehaviour<T>
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAsSupport()Constructor for use in subclassing.AsSupport(java.lang.Object owner)Constructor for use in composition.AsSupport(java.lang.Object owner, java.lang.Object role)Constructor for use in composition.AsSupport(java.lang.Object owner, java.util.Collection<java.lang.Object> roles)Constructor for use in composition.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tas(java.lang.Class<T> type)Returns an adapter to this object of the specified type.<T> Tas(java.lang.Class<T> type, As.NotFoundBehaviour<T> notFoundBehaviour)Returns an adapter to this object of the specified type.<T> java.util.Collection<T>asMany(java.lang.Class<T> type)Searches for multiple adapters of the given type and returns them.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface it.tidalwave.util.AsasOptional, maybeAs
 
- 
 
- 
- 
- 
Constructor Detail- 
AsSupportprotected AsSupport() Constructor for use in subclassing.
 - 
AsSupportpublic AsSupport(@Nonnull java.lang.Object owner)Constructor for use in composition.- Parameters:
- owner- the owner
- Since:
- 3.2-ALPHA-3 (refactored)
 
 - 
AsSupportpublic AsSupport(@Nonnull java.lang.Object owner, @Nonnull java.lang.Object role)Constructor for use in composition. In addition to the mandatory owner, it accepts a single pre-instantiated role, or aRoleFactorythat will be invoked to create additional roles.- Parameters:
- owner- the owner
- role- the role or- RoleFactory
- Since:
- 3.2-ALPHA-3
 
 - 
AsSupportpublic AsSupport(@Nonnull java.lang.Object owner, @Nonnull java.util.Collection<java.lang.Object> roles)Constructor for use in composition. In addition to the mandatory owner, it accepts a collection of pre-instantiated roles, or instances ofRoleFactorythat will be invoked to create additional roles.- Parameters:
- owner- the owner
- roles- roles or- RoleFactoryinstances
- Since:
- 3.2-ALPHA-3 (refactored)
 
 
- 
 - 
Method Detail- 
as@Nonnull public <T> T as(@Nonnull java.lang.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.
 - 
as@Nonnull public <T> T as(@Nonnull java.lang.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. First, local roles are probed; then the owner, in case it directly implements the required role; at last, the delegate is invoked.
 - 
asMany@Nonnull public <T> java.util.Collection<T> asMany(@Nonnull java.lang.Class<T> type)Searches for multiple adapters of the given type and returns them. The list contains all the relevant local roles, as well as those retrieved by the delegate, in this order.
 
- 
 
-