Top Description Fields Constructors Methods
liquibase.change

public Class ChangeParameterMetaData

extends Object
Class Inheritance
Imports
liquibase.change.core.LoadDataColumnConfig, liquibase.database.Database, .DatabaseFactory, .DatabaseList, liquibase.exception.UnexpectedLiquibaseException, .ValidationErrors, liquibase.serializer.LiquibaseSerializable, liquibase.sqlgenerator.SqlGeneratorFactory, liquibase.statement.DatabaseFunction, .SequenceNextValueFunction, .SqlStatement, liquibase.util.ObjectUtil, .StringUtil, java.beans.PropertyDescriptor, java.lang.reflect.Method, .ParameterizedType, .Type, java.math.BigInteger, java.util.*

Static metadata about a Change parameter. Instances of this class are tracked within ChangeMetaData and are immutable.

Field Summary

Modifier and TypeField and Description
public static final String
private final Change
public static final String
private String
private Class<T>
private Type[]
private final String
private final String
private final Map<String, Object>
private final String
public static final String
private final String
private Optional<Method>
private Set<String>
private final String[]
private final LiquibaseSerializable.SerializationType
private final String
private Set<String>
private final String[]
private Optional<Method>

Constructor Summary

AccessConstructor and Description
public
ChangeParameterMetaData(Change change, String parameterName, String displayName, String description, Map<String, Object> exampleValues, String since, Type dataType, String[] requiredForDatabase, String[] supportedDatabases, String mustEqualExisting, LiquibaseSerializable.SerializationType serializationType)

Method Summary

Modifier and TypeMethod and Description
private static boolean
allowUnboxing(Class<?> actual, Class<?> expected)

protected Set<String>
analyzeRequiredDatabases(String[] requiredDatabases)

protected Set<String>
analyzeSupportedDatabases(String[] supportedDatabases)

public Object
getCurrentValue(Change change)

Returns the current value of this parameter for the given Change.

public String
getDataType()

Return the data type of value stored in this parameter.

public Class<T>
public Type[]
public String
public String
getDisplayName()

A more friendly name of the parameter.

public Object
public String
getMustEqualExisting()

Returns a dot-delimited chain of liquibase.structure.DatabaseObject fields describing what existing value this parameter would need to be set if applying the Change to a particular DatabaseObject.

public String
getParameterName()

Programmatic Name of the parameter.

private Method
public Set<String>
getRequiredForDatabase()

Return the database types for which this parameter is required.

public LiquibaseSerializable.SerializationType
public String
private static ValidationErrors
getStatementErrors(Change testChange, Database database)

public Set<String>
private Method
public boolean
isRequiredFor(Database database)

A convenience method for testing the value returned by getRequiredForDatabase() against a given database.

public void
setValue(Change change, Object value)

Sets the value of this parameter on the given change.

public boolean
supports(Database database)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public ChangeParameterMetaData
withAccessors(Method readMethod, Method writeMethod)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ALLback to summary
public static final String ALL
changeback to summary
private final Change change
COMPUTEback to summary
public static final String COMPUTE
dataTypeback to summary
private String dataType
dataTypeClassback to summary
private Class<T> dataTypeClass
dataTypeClassParametersback to summary
private Type[] dataTypeClassParameters
descriptionback to summary
private final String description
displayNameback to summary
private final String displayName
exampleValuesback to summary
private final Map<String, Object> exampleValues
mustEqualExistingback to summary
private final String mustEqualExisting
NONEback to summary
public static final String NONE
parameterNameback to summary
private final String parameterName
readMethodRefback to summary
private Optional<Method> readMethodRef
requiredForDatabaseback to summary
private Set<String> requiredForDatabase
requiredForDatabaseArgback to summary
private final String[] requiredForDatabaseArg
serializationTypeback to summary
private final LiquibaseSerializable.SerializationType serializationType
sinceback to summary
private final String since
supportedDatabasesback to summary
private Set<String> supportedDatabases
supportedDatabasesArgback to summary
private final String[] supportedDatabasesArg
writeMethodRefback to summary
private Optional<Method> writeMethodRef

Constructor Detail

ChangeParameterMetaDataback to summary
public ChangeParameterMetaData(Change change, String parameterName, String displayName, String description, Map<String, Object> exampleValues, String since, Type dataType, String[] requiredForDatabase, String[] supportedDatabases, String mustEqualExisting, LiquibaseSerializable.SerializationType serializationType)

Method Detail

allowUnboxingback to summary
private static boolean allowUnboxing(Class<?> actual, Class<?> expected)
analyzeRequiredDatabasesback to summary
protected Set<String> analyzeRequiredDatabases(String[] requiredDatabases)
analyzeSupportedDatabasesback to summary
protected Set<String> analyzeSupportedDatabases(String[] supportedDatabases)
getCurrentValueback to summary
public Object getCurrentValue(Change change)

Returns the current value of this parameter for the given Change.

getDataTypeback to summary
public String getDataType()

Return the data type of value stored in this parameter. Used for documentation and integration purposes as well as validation.

getDataTypeClassback to summary
public Class<T> getDataTypeClass()
getDataTypeClassParametersback to summary
public Type[] getDataTypeClassParameters()
getDescriptionback to summary
public String getDescription()
getDisplayNameback to summary
public String getDisplayName()

A more friendly name of the parameter.

getExampleValueback to summary
public Object getExampleValue(Database database)
getMustEqualExistingback to summary
public String getMustEqualExisting()

Returns a dot-delimited chain of liquibase.structure.DatabaseObject fields describing what existing value this parameter would need to be set if applying the Change to a particular DatabaseObject.

For example, in an addColumn Change, the "name" parameter would return "column.name" because if you know of an existing Column object, the "name" parameter needs to be set to the column's name. In the addColumn's "tableName" parameter, this method would return "column.table.name".

The values of the chain correspond to the liquibase.structure.DatabaseObject#getObjectTypeName() and liquibase.structure.DatabaseObject#getAttributes()

This method is used by integrations that want to generate Change instances or configurations pre-filled with data required to apply to an existing database object.
getParameterNameback to summary
public String getParameterName()

Programmatic Name of the parameter. Will not contain spaces so it can be used for XMl tag names etc. By convention, Change names should start be camel case starting with a lower case letter.

getReadMethodback to summary
private Method getReadMethod(Change change)
getRequiredForDatabaseback to summary
public Set<String> getRequiredForDatabase()

Return the database types for which this parameter is required. The strings returned correspond to the values returned by liquibase.database.Database#getShortName(). If the parameter is required for all databases, this will return the string "all" as an element. If the parameter is required for no databases, this will return an empty set. Passing the string "none" to the constructor also results in an empty set. This method will never return a null value

getSerializationTypeback to summary
public LiquibaseSerializable.SerializationType getSerializationType()

Return the liquibase.serializer.LiquibaseSerializable.SerializationType to use when serializing this object.

getSinceback to summary
public String getSince()
getStatementErrorsback to summary
private static ValidationErrors getStatementErrors(Change testChange, Database database)
getSupportedDatabasesback to summary
public Set<String> getSupportedDatabases()
getWriteMethodback to summary
private Method getWriteMethod(Change change)
isRequiredForback to summary
public boolean isRequiredFor(Database database)

A convenience method for testing the value returned by getRequiredForDatabase() against a given database. Returns true if the Database#getShortName() method is contained in the required databases or the required database list contains the string "all"

setValueback to summary
public void setValue(Change change, Object value)

Sets the value of this parameter on the given change.

supportsback to summary
public boolean supports(Database database)
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
withAccessorsback to summary
public ChangeParameterMetaData withAccessors(Method readMethod, Method writeMethod)