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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The priority of anything that does not implement this interface.
    static final int
    A 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

    Modifier and Type
    Method
    Description
    int
     
  • Field Details

    • DEFAULT_PRIORITY

      static final int DEFAULT_PRIORITY
      The priority of anything that does not implement this interface.
      See Also:
    • YIELDS_TO_OTHERS

      static final int YIELDS_TO_OTHERS
      A 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()