Package liquibase.change
Class ChangeParameterMetaData
- java.lang.Object
-
- liquibase.change.ChangeParameterMetaData
-
public class ChangeParameterMetaData extends Object
Static metadata about aChange
parameter. Instances of this class are tracked withinChangeMetaData
and are immutable.
-
-
Constructor Summary
Constructors Constructor Description 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)
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, String[] alternateParameterNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<String>
analyzeRequiredDatabases(String[] requiredDatabases)
protected Set<String>
analyzeSupportedDatabases(String[] supportedDatabases)
Object
getCurrentValue(Change change)
Returns the current value of this parameter for the given Change.String
getDataType()
Return the data type of value stored in this parameter.Class
getDataTypeClass()
Type[]
getDataTypeClassParameters()
String
getDescription()
String
getDisplayName()
A more friendly name of the parameter.Object
getExampleValue(Database database)
String
getMustEqualExisting()
Returns a dot-delimited chain ofDatabaseObject
fields describing what existing value this parameter would need to be set if applying the Change to a particular DatabaseObject.String
getParameterName()
Programmatic Name of the parameter.Set<String>
getRequiredForDatabase()
Return the database types for which this parameter is required.LiquibaseSerializable.SerializationType
getSerializationType()
Return theLiquibaseSerializable.SerializationType
to use when serializing this object.String
getSince()
Set<String>
getSupportedDatabases()
boolean
isRequiredFor(Database database)
A convenience method for testing the value returned bygetRequiredForDatabase()
against a given database.void
setValue(Change change, Object value)
Sets the value of this parameter on the given change.boolean
supports(Database database)
String
toString()
ChangeParameterMetaData
withAccessors(Method readMethod, Method writeMethod)
-
-
-
Field Detail
-
COMPUTE
public static final String COMPUTE
- See Also:
- Constant Field Values
-
ALL
public static final String ALL
- See Also:
- Constant Field Values
-
NONE
public static final String NONE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChangeParameterMetaData
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)
-
ChangeParameterMetaData
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, String[] alternateParameterNames)
-
-
Method Detail
-
withAccessors
public ChangeParameterMetaData withAccessors(Method readMethod, Method writeMethod)
-
analyzeSupportedDatabases
protected Set<String> analyzeSupportedDatabases(String[] supportedDatabases)
-
analyzeRequiredDatabases
protected Set<String> analyzeRequiredDatabases(String[] requiredDatabases)
-
getParameterName
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.
-
getDisplayName
public String getDisplayName()
A more friendly name of the parameter.
-
getSince
public String getSince()
-
getDataType
public String getDataType()
Return the data type of value stored in this parameter. Used for documentation and integration purposes as well as validation.
-
getDataTypeClass
public Class getDataTypeClass()
-
getDataTypeClassParameters
public Type[] getDataTypeClassParameters()
-
getRequiredForDatabase
public Set<String> getRequiredForDatabase()
Return the database types for which this parameter is required. The strings returned correspond to the values returned byDatabase.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
-
isRequiredFor
public boolean isRequiredFor(Database database)
A convenience method for testing the value returned bygetRequiredForDatabase()
against a given database. Returns true if theDatabase.getShortName()
method is contained in the required databases or the required database list contains the string "all"
-
supports
public boolean supports(Database database)
-
getCurrentValue
public Object getCurrentValue(Change change)
Returns the current value of this parameter for the given Change.
-
setValue
public void setValue(Change change, Object value)
Sets the value of this parameter on the given change.
-
getMustEqualExisting
public String getMustEqualExisting()
Returns a dot-delimited chain ofDatabaseObject
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 theDatabaseObject.getObjectTypeName()
andDatabaseObject.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.
-
getSerializationType
public LiquibaseSerializable.SerializationType getSerializationType()
Return theLiquibaseSerializable.SerializationType
to use when serializing this object.
-
getDescription
public String getDescription()
-
-