Interface PrioritizedFactory
- All Known Implementing Classes:
Jackson3ChatMessageJsonCodecFactory, Jackson3InMemoryEmbeddingStoreJsonCodecFactory, Jackson3JsonCodecFactory, Jackson3ProviderJsonCodecFactory, Jackson3StateJsonCodecFactory, Jackson3StructuredPromptFactory, Jackson3ToolSpecificationJsonCodecFactory
public interface PrioritizedFactory
Decides which implementation wins when more than one is registered for the same service.
Every caller of ServiceHelper.loadFactories(Class) takes the first implementation and ignores
the rest, and without this the order is whatever the ServiceLoader happened to
enumerate - which can differ between a development run, a shaded jar and a container image.
Higher wins. A factory that does not implement this interface is DEFAULT_PRIORITY,
so an application or framework that supplies its own implementation keeps it: a factory has to
ask to lose. Among equal priorities the ServiceLoader order is preserved, and
ServiceHelper logs a warning naming the winner.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe priority of anything that does not implement this interface.static final intA priority for an implementation that should apply only when nothing else is registered for the service - the opt-in JSON codecs use this, so that adding them to an application whose framework already supplies a codec does not silently take that framework's behaviour away. -
Method Summary
-
Field Details
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITYThe priority of anything that does not implement this interface.- See Also:
-
YIELDS_TO_OTHERS
static final int YIELDS_TO_OTHERSA priority for an implementation that should apply only when nothing else is registered for the service - the opt-in JSON codecs use this, so that adding them to an application whose framework already supplies a codec does not silently take that framework's behaviour away.- See Also:
-
-
Method Details
-
priority
int priority()
-