@ConsumerType
public interface ImplementationPicker
With using the @Model.adapters attribute it is possible to define interfaces or super classes to which the model implementation is an adaption target. It is possible that multiple models implement the same type.
In this case services implementing the ImplementationPicker
interface are
queried to decide which implementation should be chosen. If multiple implementations
of this interface exists they are queried one after another by service ranking.
The first that picks an implementation is the winner.
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
pick(java.lang.Class<?> adapterType,
java.lang.Class<?>[] implementationsTypes,
java.lang.Object adaptable)
Select an implementation for the adapter class to which the adaptable should be adapted to.
|
@CheckForNull java.lang.Class<?> pick(@Nonnull java.lang.Class<?> adapterType, @Nonnull java.lang.Class<?>[] implementationsTypes, @Nonnull java.lang.Object adaptable)
adapterType
- Adapter type. Never null.implementationsTypes
- Available implementations. It is guaranteed that they can be assigned to the adapter type.
Never null and has always at least one entry.adaptable
- For reference: the adaptable. May be enquired to detect the context of the adaption. Never null.Copyright © 2018 The Apache Software Foundation. All rights reserved.