Interface NBReconfigurable

All Superinterfaces:
NBCanReconfigure, NBReconfigModelProvider
All Known Implementing Classes:
AmqpDriverAdapter, AzureAISearchDriverAdapter, BaseDriverAdapter, Cqld4DriverAdapter, CqlDriverAdapterStub, DataApiDriverAdapter, DiagDriverAdapter, DiagOpDispenser, DiagOpMapper, DiagTask_diagrate, DynamoDBDriverAdapter, ExampleDriverAdapter, GCPSpannerDriverAdapter, HttpDriverAdapter, KafkaDriverAdapter, MongodbDriverAdapter, Neo4JDriverAdapter, PulsarDriverAdapter, QdrantDriverAdapter, S4JDriverAdapter, StdoutDriverAdapter, TcpClientDriverAdapter, TcpServerDriverAdapter, WeaviateDriverAdapter

public interface NBReconfigurable extends NBCanReconfigure, NBReconfigModelProvider
All implementation types which wish to have a type-marshalled configuration should implement this interface IFF they wish to support follow-on configuration after initialization. This is distinct and separate from initial configuration via NBConfigurable. A type may be NBReconfigurable without implementing the NBConfigurable interface, given that initialization for a type may happen via constructor or other means. When a type which implements this interface is instantiated, and the NBConfiguration was not injected into its constructor, the builder should call NBConfigurable.applyConfig(NBConfiguration) immediately after calling the constructor. Subsequently, when an owning instance has a configuration update to provide to the original NBConfigurable which ALSO implements NBReconfigurable, then applyReconfig(NBConfiguration) should be called. The helper methods collectModels(Class, Collection) and applyMatching(NBConfiguration, Collection) can be used to apply reconfigurations to groups of elements with a shared configuration model.
  • Method Details

    • applyReconfig

      void applyReconfig(NBConfiguration recfg)
      This applies a configuration to an element AFTER the initial configuration from NBConfigurable.
      Specified by:
      applyReconfig in interface NBCanReconfigure
      Parameters:
      recfg - The configuration data to be applied to a new instance
    • getReconfigModel

      NBConfigModel getReconfigModel()
      Implement this method by returning an instance of ConfigModel. Any configuration which is provided to the applyReconfig(NBConfiguration) method will be validated through this model. A configuration model is required in order to build a validated configuration from source data provided by a user.
      Specified by:
      getReconfigModel in interface NBReconfigModelProvider
      Returns:
      A valid configuration model for the implementing class
    • applyMatching

      static void applyMatching(NBConfiguration cfg, Collection<?> configurables)
      Convenience method to apply a configuration to any object which is expected to be be configurable.
      Parameters:
      cfg - The cfg to apply
      configurables - zero or more Objects which may implement NBConfigurable
    • collectModels

      static NBConfigModel collectModels(Class<?> of, Collection<?> configurables)
      Create a composite configuration model from all the provided elements of the collection which implement NBReconfigurable
      Parameters:
      of - The nominal type of the composite configuration model
      configurables - zero or more elements which may implement NBReconfigurable
      Returns:
      the combined model