@Test public void getFieldTest() { ConfigurationModelMutable configurationModelMutable = new ConfigurationModelMutable(descriptorId, configurationId, createdAt, lastUpdated, configContextEnum.name()); configurationModelMutable.put(configurationFieldModel); Optional<ConfigurationFieldModel> testConfigurationFieldModel = configurationModelMutable.getField(fieldKey); Optional<ConfigurationFieldModel> testConfigurationFieldModelEmpty = configurationModelMutable.getField("badKey"); assertTrue(testConfigurationFieldModel.isPresent()); assertFalse(testConfigurationFieldModelEmpty.isPresent()); assertEquals(configurationFieldModel, testConfigurationFieldModel.get()); }
public void put(ConfigurationFieldModel configFieldModel) { Objects.requireNonNull(configFieldModel); String fieldKey = configFieldModel.getFieldKey(); Objects.requireNonNull(fieldKey); if (getConfiguredFields().containsKey(fieldKey)) { ConfigurationFieldModel oldConfigField = getConfiguredFields().get(fieldKey); List<String> values = combine(oldConfigField, configFieldModel); oldConfigField.setFieldValues(values); } else { getConfiguredFields().put(fieldKey, configFieldModel); } }
ConfigurationModelMutable extends ConfigurationModel { public void put(ConfigurationFieldModel configFieldModel) { Objects.requireNonNull(configFieldModel); String fieldKey = configFieldModel.getFieldKey(); Objects.requireNonNull(fieldKey); if (getConfiguredFields().containsKey(fieldKey)) { ConfigurationFieldModel oldConfigField = getConfiguredFields().get(fieldKey); List<String> values = combine(oldConfigField, configFieldModel); oldConfigField.setFieldValues(values); } else { getConfiguredFields().put(fieldKey, configFieldModel); } } }
ConfigurationModelMutable extends ConfigurationModel { public void put(ConfigurationFieldModel configFieldModel) { Objects.requireNonNull(configFieldModel); String fieldKey = configFieldModel.getFieldKey(); Objects.requireNonNull(fieldKey); if (getConfiguredFields().containsKey(fieldKey)) { ConfigurationFieldModel oldConfigField = getConfiguredFields().get(fieldKey); List<String> values = combine(oldConfigField, configFieldModel); oldConfigField.setFieldValues(values); } else { getConfiguredFields().put(fieldKey, configFieldModel); } } ConfigurationModelMutable(Long registeredDescriptorId, Long descriptorConfigId, String createdAt, String lastUpdated, String context);  ConfigurationModelMutable(Long registeredDescriptorId, Long descriptorConfigId, String createdAt, String lastUpdated, ConfigContextEnum context); }
ConfigurationModelMutable extends ConfigurationModel { public void put(ConfigurationFieldModel configFieldModel) { Objects.requireNonNull(configFieldModel); String fieldKey = configFieldModel.getFieldKey(); Objects.requireNonNull(fieldKey); if (getConfiguredFields().containsKey(fieldKey)) { ConfigurationFieldModel oldConfigField = getConfiguredFields().get(fieldKey); List<String> values = combine(oldConfigField, configFieldModel); oldConfigField.setFieldValues(values); } else { getConfiguredFields().put(fieldKey, configFieldModel); } } ConfigurationModelMutable(Long registeredDescriptorId, Long descriptorConfigId, String createdAt, String lastUpdated, String context);  ConfigurationModelMutable(Long registeredDescriptorId, Long descriptorConfigId, String createdAt, String lastUpdated, ConfigContextEnum context); void put(ConfigurationFieldModel configFieldModel); }
ConfigurationModelMutable extends ConfigurationModel { public void put(ConfigurationFieldModel configFieldModel) { Objects.requireNonNull(configFieldModel); String fieldKey = configFieldModel.getFieldKey(); Objects.requireNonNull(fieldKey); if (getConfiguredFields().containsKey(fieldKey)) { ConfigurationFieldModel oldConfigField = getConfiguredFields().get(fieldKey); List<String> values = combine(oldConfigField, configFieldModel); oldConfigField.setFieldValues(values); } else { getConfiguredFields().put(fieldKey, configFieldModel); } } ConfigurationModelMutable(Long registeredDescriptorId, Long descriptorConfigId, String createdAt, String lastUpdated, String context);  ConfigurationModelMutable(Long registeredDescriptorId, Long descriptorConfigId, String createdAt, String lastUpdated, ConfigContextEnum context); void put(ConfigurationFieldModel configFieldModel);  }