NBConfiguration docs

This commit is contained in:
Jonathan Shook 2021-11-19 17:37:08 -06:00
parent 00047164ae
commit af5c516744
2 changed files with 16 additions and 5 deletions

View File

@ -111,7 +111,7 @@ public class ConfigModel implements NBConfigModel {
}
@Override
public NBConfiguration extract(Map<String, ?> sharedConfig) {
public NBConfiguration extractConfig(Map<String, ?> sharedConfig) {
LinkedHashMap<String, Object> extracted = new LinkedHashMap<>();
for (String providedCfgField : sharedConfig.keySet()) {
if (getNamedParams().containsKey(providedCfgField)) {
@ -122,8 +122,8 @@ public class ConfigModel implements NBConfigModel {
}
@Override
public NBConfiguration extract(NBConfiguration cfg) {
return extract(cfg.getMap());
public NBConfiguration extractConfig(NBConfiguration cfg) {
return extractConfig(cfg.getMap());
}
private void assertDistinctSynonyms(Map<String, ?> config) {

View File

@ -37,8 +37,19 @@ public interface NBConfigModel {
* @param sharedConfig A config map which can provide fields to multiple models
* @return A new configuration for the extracted fields only.
*/
NBConfiguration extract(Map<String, ?> sharedConfig);
NBConfiguration extract(NBConfiguration cfg);
NBConfiguration extractConfig(Map<String, ?> sharedConfig);
/**
* Extract the fields from the shared config into a separate config,
* removing those that are defined in this model and leaving
* extraneous config fields in the provided model.
*
* <em>This method mutates the map that is provided.</em>
*
* @param cfg A config map which can provide fields to multiple models
* @return A new configuration for the extracted fields only.
*/
NBConfiguration extractConfig(NBConfiguration cfg);
NBConfigModel add(NBConfigModel otherModel);