public class ChangeLogParameters extends Object
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.
Constructor and Description |
---|
ChangeLogParameters()
Calls
ChangeLogParameters(Database) with a null database. |
ChangeLogParameters(Database database)
Creates a new ChangeLogParameters instance, populated with a set of "database.*" global parameters based on the passed database configuration.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Contexts |
getContexts()
Gets the contexts to filter calls to
getValue(String, DatabaseChangeLog) etc. |
String |
getDatabase()
Sets the database to filter calls to
getValue(String, DatabaseChangeLog) etc. |
LabelExpression |
getLabels()
Gets the labels to filter calls to
getValue(String, DatabaseChangeLog) etc. |
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. |
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
|
void |
set(String parameter,
Object value)
Sets a global changelog parameter with no context/label/database filters on it.
|
void |
set(String key,
Object value,
ContextExpression contexts,
Labels labels,
String... databases)
Sets a global changelog parameter.
|
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. |
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) . |
void |
setContexts(Contexts contexts)
Sets the contexts to filter calls to
getValue(String, DatabaseChangeLog) etc. |
void |
setDatabase(String filterDatabase)
Sets the database to filter calls to
getValue(String, DatabaseChangeLog) etc. |
void |
setLabels(LabelExpression labels)
Sets the labels to filter calls to
getValue(String, DatabaseChangeLog) etc. |
void |
setLocal(String parameter,
Object value,
DatabaseChangeLog changeLog)
Sets a local changelog parameter with no context/label/database filters on it.
|
void |
setLocal(String key,
Object value,
DatabaseChangeLog changeLog,
ContextExpression contexts,
Labels labels,
String... databases)
Sets a changelog parameter local to the given changeLog file.
|
public ChangeLogParameters()
ChangeLogParameters(Database)
with a null database.public ChangeLogParameters(Database database)
getDatabase()
public void set(String parameter, Object value)
set(String, Object, ContextExpression, Labels, String...)
.public void setLocal(String parameter, Object value, DatabaseChangeLog changeLog)
setLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...)
.public void set(String key, Object value, ContextExpression contexts, Labels labels, String databases, boolean globalParam, DatabaseChangeLog changeLog)
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)
set(String, Object, ContextExpression, Labels, String, boolean, DatabaseChangeLog)
.public void set(String key, Object value, ContextExpression contexts, Labels labels, String... databases)
public void setLocal(String key, Object value, DatabaseChangeLog changeLog, ContextExpression contexts, Labels labels, String... databases)
changeLog
- required for local parameters, ignored for global parameterspublic Object getValue(String key, DatabaseChangeLog changeLog)
getContexts()
and getLabels()
and the database.public boolean hasValue(String key, DatabaseChangeLog changeLog)
public String expandExpressions(String string, DatabaseChangeLog changeLog) throws UnknownChangeLogParameterException
public Contexts getContexts()
getValue(String, DatabaseChangeLog)
etc. with.public void setContexts(Contexts contexts)
getValue(String, DatabaseChangeLog)
etc. with.public LabelExpression getLabels()
getValue(String, DatabaseChangeLog)
etc. with.public void setLabels(LabelExpression labels)
getValue(String, DatabaseChangeLog)
etc. with.public String getDatabase()
getValue(String, DatabaseChangeLog)
etc. with.public void setDatabase(String filterDatabase)
getValue(String, DatabaseChangeLog)
etc. with.Copyright © 2023 Liquibase.org. All rights reserved.