@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 |
---|---|
Class<?> |
pick(Class<?> adapterType,
Class<?>[] implementationsTypes,
Object adaptable)
Select an implementation for the adapter class to which the adaptable should be adapted to.
|
@CheckForNull Class<?> pick(@Nonnull Class<?> adapterType, @Nonnull Class<?>[] implementationsTypes, @Nonnull 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 © 2017 The Apache Software Foundation. All rights reserved.