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