Top Description Inners Fields Constructors Methods
liquibase.changelog

public Class ChangeLogParameters

extends Object
Class Inheritance
Imports
liquibase.ContextExpression, .Contexts, .LabelExpression, .Labels, liquibase.database.Database, .DatabaseList, liquibase.exception.DatabaseException, .UnknownChangeLogParameterException, liquibase.util.StringUtil, java.util.*, java.util.stream.Collectors

Holds the parameters configured for a DatabaseChangeLog.

In general, the end behavior of defined parameters is "the first set value wins". For example, if you set a parameter "x" to "1" and then set it to "2", the value will remain "1". This immutable property behavior allows users to easily set default values, knowing that any "upstream" overrides will take priority.

In determining which property value is actually "first set", context, label, and dbms filtering is taken into account.

Properties can be defined as "global" or "local". Global properties span all change logs. A global setting configured in an included changelog is still available to all changesets Local properties are only available in the change log that they are defined in -- not even in changelogs "included" by the file that defines the property.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final ExpressionExpander
private Contexts
private String
private LabelExpression
private final List<ChangeLogParameters.ChangeLogParameter>
private final Map<String, List<ChangeLogParameters.ChangeLogParameter>>

Constructor Summary

AccessConstructor and Description
public
public
ChangeLogParameters(Database database)

Creates a new ChangeLogParameters instance, populated with a set of "database.*" global parameters based on the passed database configuration.

Method Summary

Modifier and TypeMethod and Description
public String
expandExpressions(String string, DatabaseChangeLog changeLog)

Expand any expressions in the given string, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured in this instance.

private ChangeLogParameters.ChangeLogParameter
public Contexts
getContexts()

Gets the contexts to filter calls to getValue(String, DatabaseChangeLog) etc. with.

public String
getDatabase()

Sets the database to filter calls to getValue(String, DatabaseChangeLog) etc. with.

private ChangeLogParameters.Filter
public LabelExpression
getLabels()

Gets the labels to filter calls to getValue(String, DatabaseChangeLog) etc. with.

private String
getLocalKey(DatabaseChangeLog changeLog)

The key to use in localParameters

public Object
getValue(String key, DatabaseChangeLog changeLog)

Get the value of the given parameter, taking into account parameters local to the given changelog file and values configured in getContexts() and getLabels() and the database.

public boolean
hasValue(String key, DatabaseChangeLog changeLog)

Return whether the given parameters is defined, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured on this instance

public void
set(String parameter, Object value)

Sets a global changelog parameter with no context/label/database filters on it.

public void
set(String key, Object value, ContextExpression contexts, Labels labels, String databases, boolean globalParam, DatabaseChangeLog changeLog)

Calls either set(String, Object, ContextExpression, Labels, String...) or setLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...) depending on the value of globalParam.

public void
set(String key, Object value, String contexts, String labels, String databases, boolean globalParam, DatabaseChangeLog changeLog)

Convenience version of set(String, Object, ContextExpression, Labels, String, boolean, DatabaseChangeLog).

public void
set(String key, Object value, ContextExpression contexts, Labels labels, String... databases)

Sets a global changelog parameter.

public void
setContexts(Contexts contexts)

Sets the contexts to filter calls to getValue(String, DatabaseChangeLog) etc. with.

public void
setDatabase(String filterDatabase)

Sets the database to filter calls to getValue(String, DatabaseChangeLog) etc. with.

public void
setLabels(LabelExpression labels)

Sets the labels to filter calls to getValue(String, DatabaseChangeLog) etc. with.

public void
setLocal(String parameter, Object value, DatabaseChangeLog changeLog)

Sets a local changelog parameter with no context/label/database filters on it.

public void
setLocal(String key, Object value, DatabaseChangeLog
required for local parameters, ignored for global parameters
changeLog
,
ContextExpression contexts, Labels labels, String... databases)

Sets a changelog parameter local to the given changeLog file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

expressionExpanderback to summary
private final ExpressionExpander expressionExpander
filterContextsback to summary
private Contexts filterContexts
filterDatabaseback to summary
private String filterDatabase
filterLabelsback to summary
private LabelExpression filterLabels
globalParametersback to summary
private final List<ChangeLogParameters.ChangeLogParameter> globalParameters
localParametersback to summary
private final Map<String, List<ChangeLogParameters.ChangeLogParameter>> localParameters

Constructor Detail

ChangeLogParametersback to summary
public ChangeLogParameters()

Calls ChangeLogParameters(Database) with a null database.

ChangeLogParametersback to summary
public ChangeLogParameters(Database database)

Creates a new ChangeLogParameters instance, populated with a set of "database.*" global parameters based on the passed database configuration. If the database is null, no global parameters are added.

The passed database is used as a default value for getDatabase()

Method Detail

expandExpressionsback to summary
public String expandExpressions(String string, DatabaseChangeLog changeLog) throws UnknownChangeLogParameterException

Expand any expressions in the given string, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured in this instance.

getChangelogParameterback to summary
private ChangeLogParameters.ChangeLogParameter getChangelogParameter(String key, DatabaseChangeLog changeLog, ChangeLogParameters.Filter filter)
getContextsback to summary
public Contexts getContexts()

Gets the contexts to filter calls to getValue(String, DatabaseChangeLog) etc. with.

getDatabaseback to summary
public String getDatabase()

Sets the database to filter calls to getValue(String, DatabaseChangeLog) etc. with.

getFilterback to summary
private ChangeLogParameters.Filter getFilter()
getLabelsback to summary
public LabelExpression getLabels()

Gets the labels to filter calls to getValue(String, DatabaseChangeLog) etc. with.

getLocalKeyback to summary
private String getLocalKey(DatabaseChangeLog changeLog)

The key to use in localParameters

getValueback to summary
public Object getValue(String key, DatabaseChangeLog changeLog)

Get the value of the given parameter, taking into account parameters local to the given changelog file and values configured in getContexts() and getLabels() and the database.

hasValueback to summary
public boolean hasValue(String key, DatabaseChangeLog changeLog)

Return whether the given parameters is defined, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured on this instance

setback to summary
public void set(String parameter, Object value)

Sets a global changelog parameter with no context/label/database filters on it. Convenience version of set(String, Object, ContextExpression, Labels, String...).

setback to summary
public void set(String key, Object value, ContextExpression contexts, Labels labels, String databases, boolean globalParam, DatabaseChangeLog changeLog)

Calls either set(String, Object, ContextExpression, Labels, String...) or setLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...) depending on the value of globalParam.

setback to summary
public void set(String key, Object value, String contexts, String labels, String databases, boolean globalParam, DatabaseChangeLog changeLog)

Convenience version of set(String, Object, ContextExpression, Labels, String, boolean, DatabaseChangeLog).

setback to summary
public void set(String key, Object value, ContextExpression contexts, Labels labels, String... databases)

Sets a global changelog parameter. Just because you call this with a particular key, does not mean it will override the existing value. See the class description for more details on how values act as if they are immutable.

setContextsback to summary
public void setContexts(Contexts contexts)

Sets the contexts to filter calls to getValue(String, DatabaseChangeLog) etc. with.

setDatabaseback to summary
public void setDatabase(String filterDatabase)

Sets the database to filter calls to getValue(String, DatabaseChangeLog) etc. with.

setLabelsback to summary
public void setLabels(LabelExpression labels)

Sets the labels to filter calls to getValue(String, DatabaseChangeLog) etc. with.

setLocalback to summary
public void setLocal(String parameter, Object value, DatabaseChangeLog changeLog)

Sets a local changelog parameter with no context/label/database filters on it. Convenience version of setLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...).

setLocalback to summary
public void setLocal(String key, Object value, DatabaseChangeLog changeLog, ContextExpression contexts, Labels labels, String... databases)

Sets a changelog parameter local to the given changeLog file. Just because you call this with a particular key, does not mean it will override the existing value. See the class description for more details on how values act as if they are immutable.

Parameters
changeLog:DatabaseChangeLog

required for local parameters, ignored for global parameters

liquibase.changelog back to summary

private Class ChangeLogParameters.ChangeLogParameter

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String
private final ContextExpression
private final List<String>
private final Labels
private final Object

Constructor Summary

AccessConstructor and Description
public
public
ChangeLogParameter(String key, Object value, ContextExpression validContexts, Labels labels, String[] validDatabases)

Method Summary

Modifier and TypeMethod and Description
public String
public Labels
public ContextExpression
public List<String>
public Object
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

keyback to summary
private final String key
validContextsback to summary
private final ContextExpression validContexts
validDatabasesback to summary
private final List<String> validDatabases
validLabelsback to summary
private final Labels validLabels
valueback to summary
private final Object value

Constructor Detail

ChangeLogParameterback to summary
public ChangeLogParameter(String key, Object value)
ChangeLogParameterback to summary
public ChangeLogParameter(String key, Object value, ContextExpression validContexts, Labels labels, String[] validDatabases)

Method Detail

getKeyback to summary
public String getKey()
getLabelsback to summary
public Labels getLabels()
getValidContextsback to summary
public ContextExpression getValidContexts()
getValidDatabasesback to summary
public List<String> getValidDatabases()
getValueback to summary
public Object getValue()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
liquibase.changelog back to summary

private Class ChangeLogParameters.Filter

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Contexts
private final String
private final LabelExpression

Constructor Summary

AccessConstructor and Description
public
Filter(String database, Contexts contexts, LabelExpression labels)

Method Summary

Modifier and TypeMethod and Description
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextsback to summary
private final Contexts contexts
databaseback to summary
private final String database
labelsback to summary
private final LabelExpression labels

Constructor Detail

Filterback to summary
public Filter(String database, Contexts contexts, LabelExpression labels)

Method Detail

matchesback to summary
public boolean matches(ChangeLogParameters.ChangeLogParameter parameter)