liquibase.configuration
Class AbstractConfigurationContainer

java.lang.Object
  extended by liquibase.configuration.AbstractConfigurationContainer
All Implemented Interfaces:
ConfigurationContainer
Direct Known Subclasses:
ChangeLogParserCofiguration, DefaultLoggerConfiguration, GlobalConfiguration

public abstract class AbstractConfigurationContainer
extends Object
implements ConfigurationContainer

Base class for configuration classes used by LiquibaseConfiguration. Implementations must have a no-arg constructor for LiquibaseConfiguration to initialize them as needed.

AbstractConfigurationContainer implementations contain a "namespace" which can be used as the prefix to system properties or cases where there may be name conflicts.

Properties can be accessed by name using the getValue(String, Class) method, but implementation should implement standard get/set methods for easier use.


Nested Class Summary
protected static class AbstractConfigurationContainer.ConfigurationContainer
          Like a java.util.Map, but with extra logic for working with ConfigurationProperties.
 
Constructor Summary
protected AbstractConfigurationContainer(String namespace)
          Subclasses must call this constructor passing the namespace, but must themselves provide a no-arg public constructor.
 
Method Summary
protected  AbstractConfigurationContainer.ConfigurationContainer getContainer()
           
 Set<ConfigurationProperty> getProperties()
          Return all available properties.
 ConfigurationProperty getProperty(String propertyName)
          Return the ConfigurationProperty object for the given property name.
<T> T
getValue(String propertyName, Class<T> returnType)
          Returns the value for the given property cast to the passed returnType.
 void init(ConfigurationValueProvider... configurationValueProviders)
          Override default values for properties with the given ConfigurationProviders.
 void setValue(String propertyName, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConfigurationContainer

protected AbstractConfigurationContainer(String namespace)
Subclasses must call this constructor passing the namespace, but must themselves provide a no-arg public constructor.

Method Detail

getContainer

protected AbstractConfigurationContainer.ConfigurationContainer getContainer()

getProperty

public ConfigurationProperty getProperty(String propertyName)
Return the ConfigurationProperty object for the given property name. Normally getValue(String, Class) is the easiest method to call.

Specified by:
getProperty in interface ConfigurationContainer

getProperties

public Set<ConfigurationProperty> getProperties()
Return all available properties.

Specified by:
getProperties in interface ConfigurationContainer

getValue

public <T> T getValue(String propertyName,
                      Class<T> returnType)
Returns the value for the given property cast to the passed returnType. If the type of the property and the given return type are not compatible an exception will be thrown. If the passed propertyName is not a defined property, an exception is thrown.

Specified by:
getValue in interface ConfigurationContainer

init

public void init(ConfigurationValueProvider... configurationValueProviders)
Override default values for properties with the given ConfigurationProviders.

Specified by:
init in interface ConfigurationContainer

setValue

public void setValue(String propertyName,
                     Object value)
Specified by:
setValue in interface ConfigurationContainer


Copyright © 2016 Liquibase.org. All rights reserved.