Class DefaultConfiguration<T extends IConfigurationFeature<?>>
- java.lang.Object
-
- gov.nist.secauto.metaschema.core.configuration.DefaultConfiguration<T>
-
- Type Parameters:
T
- the type of managed features
- All Implemented Interfaces:
IConfiguration<T>
,IMutableConfiguration<T>
public class DefaultConfiguration<T extends IConfigurationFeature<?>> extends Object implements IMutableConfiguration<T>
Provides a basic configuration management implementation that allows mutable access to configuration state.
-
-
Constructor Summary
Constructors Constructor Description DefaultConfiguration()
Create a new configuration.DefaultConfiguration(DefaultConfiguration<T> original)
Create a new configuration based on the provided configuration.DefaultConfiguration(Map<T,Object> featureValues)
Create a new configuration based on the provided feature value map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IMutableConfiguration<T>
applyConfiguration(IConfiguration<T> original)
Replace this configuration with theother
configuration.IMutableConfiguration<T>
disableFeature(T feature)
Turn off the provided feature.IMutableConfiguration<T>
enableFeature(T feature)
Turn on the provided feature.Map<T,Object>
getFeatureValues()
Get the mapping of each feature mapped to its value.boolean
isFeatureEnabled(T feature)
Determines if a specific feature is enabled.IMutableConfiguration<T>
set(T feature, Object value)
Set the value of the providedfeature
to the provided value.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
get
-
-
-
-
Constructor Detail
-
DefaultConfiguration
public DefaultConfiguration()
Create a new configuration.
-
DefaultConfiguration
public DefaultConfiguration(@NonNull Map<T,Object> featureValues)
Create a new configuration based on the provided feature value map.- Parameters:
featureValues
- the set of enabled features
-
DefaultConfiguration
public DefaultConfiguration(@NonNull DefaultConfiguration<T> original)
Create a new configuration based on the provided configuration.- Parameters:
original
- the original configuration
-
-
Method Detail
-
getFeatureValues
public Map<T,Object> getFeatureValues()
Description copied from interface:IConfiguration
Get the mapping of each feature mapped to its value.- Specified by:
getFeatureValues
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
- Returns:
- the mapping
-
isFeatureEnabled
public boolean isFeatureEnabled(@NonNull T feature)
Description copied from interface:IConfiguration
Determines if a specific feature is enabled.- Specified by:
isFeatureEnabled
in interfaceIConfiguration<T extends IConfigurationFeature<?>>
- Parameters:
feature
- the feature to check for- Returns:
true
if the feature is enabled, orfalse
otherwise- See Also:
IConfigurationFeature.getValueClass()
-
enableFeature
public IMutableConfiguration<T> enableFeature(@NonNull T feature)
Description copied from interface:IMutableConfiguration
Turn on the provided feature.- Specified by:
enableFeature
in interfaceIMutableConfiguration<T extends IConfigurationFeature<?>>
- Parameters:
feature
- the feature to turn on- Returns:
- the updated configuration
- See Also:
IConfigurationFeature.getValueClass()
-
disableFeature
public IMutableConfiguration<T> disableFeature(@NonNull T feature)
Description copied from interface:IMutableConfiguration
Turn off the provided feature.- Specified by:
disableFeature
in interfaceIMutableConfiguration<T extends IConfigurationFeature<?>>
- Parameters:
feature
- the feature to turn off- Returns:
- the updated configuration
- See Also:
IConfigurationFeature.getValueClass()
-
applyConfiguration
public IMutableConfiguration<T> applyConfiguration(@NonNull IConfiguration<T> original)
Description copied from interface:IMutableConfiguration
Replace this configuration with theother
configuration.- Specified by:
applyConfiguration
in interfaceIMutableConfiguration<T extends IConfigurationFeature<?>>
- Parameters:
original
- the new configuration- Returns:
- the updated configuration
-
set
public IMutableConfiguration<T> set(T feature, Object value)
Description copied from interface:IMutableConfiguration
Set the value of the providedfeature
to the provided value.- Specified by:
set
in interfaceIMutableConfiguration<T extends IConfigurationFeature<?>>
- Parameters:
feature
- the feature to setvalue
- the value to set- Returns:
- the updated configuration
- See Also:
IConfigurationFeature.getValueClass()
-
-