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
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 Summary
Modifier and TypeMethodDescriptionstatic voidapplyMatching(NBConfiguration cfg, Collection<?> configurables) Convenience method to apply a configuration to any object which is expected to be be configurable.voidapplyReconfig(NBConfiguration recfg) This applies a configuration to an element AFTER the initial configuration fromNBConfigurable.static NBConfigModelcollectModels(Class<?> of, Collection<?> configurables) Create a composite configuration model from all the provided elements of the collection which implementNBReconfigurableImplement this method by returning an instance ofConfigModel.
-
Method Details
-
applyReconfig
This applies a configuration to an element AFTER the initial configuration fromNBConfigurable.- Specified by:
applyReconfigin interfaceNBCanReconfigure- Parameters:
recfg- The configuration data to be applied to a new instance
-
getReconfigModel
NBConfigModel getReconfigModel()Implement this method by returning an instance ofConfigModel. Any configuration which is provided to theapplyReconfig(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:
getReconfigModelin interfaceNBReconfigModelProvider- Returns:
- A valid configuration model for the implementing class
-
applyMatching
Convenience method to apply a configuration to any object which is expected to be be configurable.- Parameters:
cfg- The cfg to applyconfigurables- zero or more Objects which may implement NBConfigurable
-
collectModels
Create a composite configuration model from all the provided elements of the collection which implementNBReconfigurable- Parameters:
of- The nominal type of the composite configuration modelconfigurables- zero or more elements which may implementNBReconfigurable- Returns:
- the combined model
-