Top Description Inners Fields Constructors Methods
liquibase.change

public Class ColumnConfig

extends AbstractLiquibaseSerializable
Class Inheritance
Known Direct Subclasses
liquibase.change.core.LoadDataColumnConfig, liquibase.change.AddColumnConfig
Imports
liquibase.exception.DateParseException, liquibase.parser.core.ParsedNode, .ParsedNodeException, liquibase.resource.ResourceAccessor, liquibase.serializer.AbstractLiquibaseSerializable, .ReflectionSerializer, liquibase.statement.DatabaseFunction, .NotNullConstraint, .SequenceCurrentValueFunction, .SequenceNextValueFunction, liquibase.structure.core.*, liquibase.util.*, java.math.BigInteger, java.text.NumberFormat, .ParseException, java.util.Date, .List, .Locale

The standard configuration used by Change classes to represent a column. It is not required that a column-based Change uses this class, but parsers should look for it so it is a helpful convenience. The definitions of "defaultValue" and "value" will vary based on the Change and may not be applicable in all cases.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private Boolean
private Boolean
private ConstraintsConfig
private Boolean
private String
private Boolean
private DatabaseFunction
private String
private Date
private Number
private SequenceNextValueFunction
private Boolean
private String
private String
private BigInteger
private String
private String
private BigInteger
private String
private String
private String
private Boolean
private String
private DatabaseFunction
private Date
private Number
private SequenceCurrentValueFunction
private SequenceNextValueFunction

Constructor Summary

AccessConstructor and Description
public
ColumnConfig(Column columnSnapshot)

Create a ColumnConfig object based on a Column snapshot.

public
ColumnConfig()

Create am empty ColumnConfig object.

Method Summary

Modifier and TypeMethod and Description
public static ColumnConfig[]
public static ColumnConfig
public Boolean
public ConstraintsConfig
getConstraints()

Returns the ConstraintsConfig this ColumnConfig is using.

public Boolean
public String
getDefaultValue()

The String default value to assign to this column.

public Boolean
getDefaultValueBoolean()

Return the boolean value this column should default to.

public DatabaseFunction
getDefaultValueComputed()

Return the function whose value should generate this column's default.

public String
public Date
getDefaultValueDate()

Return the date value this column should default to.

public Number
getDefaultValueNumeric()

Return the numeric value this column should default to.

public Object
getDefaultValueObject()

Return the value to set this column's default to according to the setDefaultValue* function that was called.

public SequenceNextValueFunction
public Boolean
public String
getEncoding()

Return encoding of a file, referenced via valueClobFile.

public String
public BigInteger
getIncrementBy()

Return the amount to auto increment by.

public String
getName()

The name of the column.

public String
getRemarks()

Return the remarks to apply to this column.

public LiquibaseSerializable.SerializationType
public Object
public String
public String
public BigInteger
getStartWith()

Return the number to start auto incrementing with.

public String
getType()

The data type fof the column.

public String
getValue()

The String value to set this column to.

public String
getValueBlobFile()

Return the file containing the data to load into a BLOB.

public Boolean
getValueBoolean()

Return the boolean value this column should be set to.

public String
getValueClobFile()

Return the file containing the data to load into a CLOB.

public DatabaseFunction
getValueComputed()

Return the function this column should be set from.

public Date
getValueDate()

Return the date value this column should be set to.

public Number
getValueNumeric()

Return the numeric value this column should be set to.

public Object
getValueObject()

Return the value from whatever setValue* function was called.

public SequenceCurrentValueFunction
public SequenceNextValueFunction
public boolean
hasDefaultValue()

Returns true if any of the setDefaultValue* functions have had a non-null value set

public Boolean
isAutoIncrement()

Returns true if this Column should be set to be auto increment.

public void
protected void
loadConstraints(ParsedNode constraintsNode)

public ColumnConfig
setAutoIncrement(Boolean autoIncrement)

public ColumnConfig
setComputed(Boolean computed)

public ColumnConfig
public ColumnConfig
setDefaultOnNull(Boolean defaultOnNull)

public ColumnConfig
setDefaultValue(String defaultValue)

Sets the string default value to assign to this column.

public ColumnConfig
setDefaultValueBoolean(String defaultValueBoolean)

Set the defaultValueBoolean based on a given string.

public ColumnConfig
setDefaultValueBoolean(Boolean defaultValueBoolean)

public ColumnConfig
public void
setDefaultValueConstraintName(String defaultValueConstraintName)

public ColumnConfig
setDefaultValueDate(Date defaultValueDate)

public ColumnConfig
setDefaultValueDate(String defaultValueDate)

Set the date this column should default to.

public ColumnConfig
setDefaultValueNumeric(String defaultValueNumeric)

Set the number this column should use as its default.

public ColumnConfig
setDefaultValueNumeric(Number defaultValueNumeric)

public ColumnConfig
public ColumnConfig
setDescending(Boolean descending)

public ColumnConfig
setEncoding(String encoding)

public ColumnConfig
setGenerationType(String generationType)

public ColumnConfig
public ColumnConfig
public ColumnConfig
setName(String name, boolean computed)

public ColumnConfig
setRemarks(String remarks)

public ColumnConfig
public ColumnConfig
public ColumnConfig
setValue(String value)

Sets the string value this column should be set to.

public ColumnConfig
setValueBlobFile(String valueBlobFile)

public ColumnConfig
setValueBoolean(String valueBoolean)

Set the valueBoolean based on a given string.

public ColumnConfig
setValueBoolean(Boolean valueBoolean)

public ColumnConfig
setValueClobFile(String valueClobFile)

public ColumnConfig
public ColumnConfig
setValueDate(String
the Date Value to use (may be null or "null", or start with "now" or "today").
valueDate
)

Set the date this column should be set to.

public ColumnConfig
setValueDate(Date valueDate)

public ColumnConfig
setValueNumeric(Number valueNumeric)

public ColumnConfig
setValueNumeric(String valueNumeric)

Set the number this column should be set to.

public ColumnConfig
public ColumnConfig
Inherited from liquibase.serializer.AbstractLiquibaseSerializable:
convertEscapedgetSerializableFieldDataTypeClassgetSerializableFieldDataTypeClassParametersgetSerializableFieldNamespacegetSerializableFieldsserializeserializeValuesetSerializableFieldValueshouldAutoLoad

Field Detail

autoIncrementback to summary
private Boolean autoIncrement
computedback to summary
private Boolean computed
constraintsback to summary
private ConstraintsConfig constraints
defaultOnNullback to summary
private Boolean defaultOnNull
defaultValueback to summary
private String defaultValue
defaultValueBooleanback to summary
private Boolean defaultValueBoolean
defaultValueComputedback to summary
private DatabaseFunction defaultValueComputed
defaultValueConstraintNameback to summary
private String defaultValueConstraintName
defaultValueDateback to summary
private Date defaultValueDate
defaultValueNumericback to summary
private Number defaultValueNumeric
defaultValueSequenceNextback to summary
private SequenceNextValueFunction defaultValueSequenceNext
descendingback to summary
private Boolean descending
encodingback to summary
private String encoding
generationTypeback to summary
private String generationType
incrementByback to summary
private BigInteger incrementBy
nameback to summary
private String name
remarksback to summary
private String remarks
startWithback to summary
private BigInteger startWith
typeback to summary
private String type
valueback to summary
private String value
valueBlobFileback to summary
private String valueBlobFile
valueBooleanback to summary
private Boolean valueBoolean
valueClobFileback to summary
private String valueClobFile
valueComputedback to summary
private DatabaseFunction valueComputed
valueDateback to summary
private Date valueDate
valueNumericback to summary
private Number valueNumeric
valueSequenceCurrentback to summary
private SequenceCurrentValueFunction valueSequenceCurrent
valueSequenceNextback to summary
private SequenceNextValueFunction valueSequenceNext

Constructor Detail

ColumnConfigback to summary
public ColumnConfig(Column columnSnapshot)

Create a ColumnConfig object based on a Column snapshot. It will attempt to set as much as possible based on the information in the snapshot.

ColumnConfigback to summary
public ColumnConfig()

Create am empty ColumnConfig object. Boolean and other object values will default to null.

Method Detail

arrayFromNamesback to summary
public static ColumnConfig[] arrayFromNames(String names)
fromNameback to summary
public static ColumnConfig fromName(String name)
getComputedback to summary
public Boolean getComputed()
getConstraintsback to summary
public ConstraintsConfig getConstraints()

Returns the ConstraintsConfig this ColumnConfig is using. Returns null if nho constraints have been assigned yet.

getDefaultOnNullback to summary
public Boolean getDefaultOnNull()
getDefaultValueback to summary
public String getDefaultValue()

The String default value to assign to this column. If you do not want the default set by setDefaultValue(String) use a more specific function like getDefaultValueNumeric() or the more generic getDefaultValueObject()

getDefaultValueBooleanback to summary
public Boolean getDefaultValueBoolean()

Return the boolean value this column should default to.

See Also
setDefaultValue(String)
getDefaultValueComputedback to summary
public DatabaseFunction getDefaultValueComputed()

Return the function whose value should generate this column's default.

See Also
setDefaultValue(String)
getDefaultValueConstraintNameback to summary
public String getDefaultValueConstraintName()
getDefaultValueDateback to summary
public Date getDefaultValueDate()

Return the date value this column should default to.

See Also
setDefaultValue(String)
getDefaultValueNumericback to summary
public Number getDefaultValueNumeric()

Return the numeric value this column should default to.

See Also
setDefaultValue(String)
getDefaultValueObjectback to summary
public Object getDefaultValueObject()

Return the value to set this column's default to according to the setDefaultValue* function that was called. If none were called, this function returns null.

getDefaultValueSequenceNextback to summary
public SequenceNextValueFunction getDefaultValueSequenceNext()
getDescendingback to summary
public Boolean getDescending()
getEncodingback to summary
public String getEncoding()

Return encoding of a file, referenced via valueClobFile.

getGenerationTypeback to summary
public String getGenerationType()
getIncrementByback to summary
public BigInteger getIncrementBy()

Return the amount to auto increment by.

getNameback to summary
public String getName()

The name of the column.

getRemarksback to summary
public String getRemarks()

Return the remarks to apply to this column.

getSerializableFieldTypeback to summary
public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)

Overrides liquibase.serializer.AbstractLiquibaseSerializable.getSerializableFieldType.

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldType.

Annotations
@Override
getSerializableFieldValueback to summary
public Object getSerializableFieldValue(String field)

Overrides liquibase.serializer.AbstractLiquibaseSerializable.getSerializableFieldValue.

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldValue.

Annotations
@Override
getSerializedObjectNameback to summary
public String getSerializedObjectName()

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectName.

Annotations
@Override
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
getStartWithback to summary
public BigInteger getStartWith()

Return the number to start auto incrementing with.

getTypeback to summary
public String getType()

The data type fof the column. This value will pass through liquibase.datatype.DataTypeFactory#fromDescription(String, liquibase.database.Database) before being included in SQL.

getValueback to summary
public String getValue()

The String value to set this column to. If you do not want the value set by setValue(String) use a more specific function like getValueNumeric() or the more generic getValueObject()

If performing an data manipulation operation, the setValue* functions should be used to set what the columns should be set to. If performing a data definition operation, this setValue* functions should be used to set what existing rows should be set to (may be different than the default value for new rows)
getValueBlobFileback to summary
public String getValueBlobFile()

Return the file containing the data to load into a BLOB.

See Also
setValue(String)
getValueBooleanback to summary
public Boolean getValueBoolean()

Return the boolean value this column should be set to.

See Also
setValue(String)
getValueClobFileback to summary
public String getValueClobFile()

Return the file containing the data to load into a CLOB.

See Also
setValue(String)
getValueComputedback to summary
public DatabaseFunction getValueComputed()

Return the function this column should be set from.

See Also
setValue(String)
getValueDateback to summary
public Date getValueDate()

Return the date value this column should be set to.

See Also
setValue(String)
getValueNumericback to summary
public Number getValueNumeric()

Return the numeric value this column should be set to.

See Also
setValue(String)
getValueObjectback to summary
public Object getValueObject()

Return the value from whatever setValue* function was called. Will return null if none were set.

getValueSequenceCurrentback to summary
public SequenceCurrentValueFunction getValueSequenceCurrent()
getValueSequenceNextback to summary
public SequenceNextValueFunction getValueSequenceNext()
hasDefaultValueback to summary
public boolean hasDefaultValue()

Returns true if any of the setDefaultValue* functions have had a non-null value set

isAutoIncrementback to summary
public Boolean isAutoIncrement()

Returns true if this Column should be set to be auto increment. Returns null if auto-increment hasn't been explicitly assigned.

loadback to summary
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException

Overrides liquibase.serializer.AbstractLiquibaseSerializable.load.

Implements liquibase.serializer.LiquibaseSerializable.load.

Annotations
@Override
loadConstraintsback to summary
protected void loadConstraints(ParsedNode constraintsNode) throws ParsedNodeException
setAutoIncrementback to summary
public ColumnConfig setAutoIncrement(Boolean autoIncrement)
setComputedback to summary
public ColumnConfig setComputed(Boolean computed)
setConstraintsback to summary
public ColumnConfig setConstraints(ConstraintsConfig constraints)
setDefaultOnNullback to summary
public ColumnConfig setDefaultOnNull(Boolean defaultOnNull)
setDefaultValueback to summary
public ColumnConfig setDefaultValue(String defaultValue)

Sets the string default value to assign to this column. If you are trying to set a default value type other than a string, use the more specific functions like setDefaultValueNumeric(Number). This method does no processing of the string. Any trimming is expected to be done beforehand. It does not convert the string "null" to null so that you can set the string "null" as a value if you are feeling particularly crazy.

setDefaultValueBooleanback to summary
public ColumnConfig setDefaultValueBoolean(String defaultValueBoolean)

Set the defaultValueBoolean based on a given string. If the passed value cannot be parsed as a boolean, it is assumed to be a function that returns a boolean. If the string "null" or an empty string is passed, it will set a null value. If "1" is passed, defaultValueBoolean is set to true. If 0 is passed, defaultValueBoolean is set to false

setDefaultValueBooleanback to summary
public ColumnConfig setDefaultValueBoolean(Boolean defaultValueBoolean)
setDefaultValueComputedback to summary
public ColumnConfig setDefaultValueComputed(DatabaseFunction defaultValueComputed)
setDefaultValueConstraintNameback to summary
public void setDefaultValueConstraintName(String defaultValueConstraintName)
setDefaultValueDateback to summary
public ColumnConfig setDefaultValueDate(Date defaultValueDate)
setDefaultValueDateback to summary
public ColumnConfig setDefaultValueDate(String defaultValueDate)

Set the date this column should default to. Supports any of the date or datetime formats handled by ISODateFormat. If the passed value cannot be parsed as a date, it is assumed to be a function that returns a date. If the string "null" or an empty string is passed, it will set a null value.

setDefaultValueNumericback to summary
public ColumnConfig setDefaultValueNumeric(String defaultValueNumeric)

Set the number this column should use as its default. Supports integers and decimals, and strips off any wrapping parentheses. If the passed value cannot be parsed as a number, it is assumed to be a function that returns a number. If the value "null" is passed, it will set a null value.

A special case is made for "GENERATED_BY_DEFAULT" which simply sets the ColumnConfig object to autoIncrement.
setDefaultValueNumericback to summary
public ColumnConfig setDefaultValueNumeric(Number defaultValueNumeric)
setDefaultValueSequenceNextback to summary
public ColumnConfig setDefaultValueSequenceNext(SequenceNextValueFunction defaultValueSequenceNext)
setDescendingback to summary
public ColumnConfig setDescending(Boolean descending)
setEncodingback to summary
public ColumnConfig setEncoding(String encoding)
setGenerationTypeback to summary
public ColumnConfig setGenerationType(String generationType)
setIncrementByback to summary
public ColumnConfig setIncrementBy(BigInteger incrementBy)
setNameback to summary
public ColumnConfig setName(String name)
setNameback to summary
public ColumnConfig setName(String name, boolean computed)
setRemarksback to summary
public ColumnConfig setRemarks(String remarks)
setStartWithback to summary
public ColumnConfig setStartWith(BigInteger startWith)
setTypeback to summary
public ColumnConfig setType(String type)
setValueback to summary
public ColumnConfig setValue(String value)

Sets the string value this column should be set to. If you are trying to set a value type other than a string, use the more specific functions like setValueNumeric(Number). This method does no processing of the string. Any trimming is expected to be done beforehand. It does not convert the string "null" to null so that you can set the string "null" as a value if you are feeling particularly crazy.

setValueBlobFileback to summary
public ColumnConfig setValueBlobFile(String valueBlobFile)
setValueBooleanback to summary
public ColumnConfig setValueBoolean(String valueBoolean)

Set the valueBoolean based on a given string. If the passed value cannot be parsed as a boolean, it is assumed to be a function that returns a boolean. If the string "null" or an empty string is passed, it will set a null value. If "1" is passed, defaultValueBoolean is set to true. If 0 is passed, defaultValueBoolean is set to false

setValueBooleanback to summary
public ColumnConfig setValueBoolean(Boolean valueBoolean)
setValueClobFileback to summary
public ColumnConfig setValueClobFile(String valueClobFile)
setValueComputedback to summary
public ColumnConfig setValueComputed(DatabaseFunction valueComputed)
setValueDateback to summary
public ColumnConfig setValueDate(String valueDate) throws DateParseException

Set the date this column should be set to. Supports any of the date or datetime formats handled by ISODateFormat. If the passed value cannot be parsed as a date, it is assumed to be a function that returns a date. If the string "null" is passed, it will set a null value.

Parameters
valueDate:String

the Date Value to use (may be null or "null", or start with "now" or "today").

Exceptions
DateParseException:
if the columnType isn't supported for "now" or "today" values.
setValueDateback to summary
public ColumnConfig setValueDate(Date valueDate)
setValueNumericback to summary
public ColumnConfig setValueNumeric(Number valueNumeric)
setValueNumericback to summary
public ColumnConfig setValueNumeric(String valueNumeric)

Set the number this column should be set to. Supports integers and decimals, and strips off any wrapping parentheses. If the passed value cannot be parsed as a number in US locale, it is assumed to be a function that returns a number. If the value "null" is passed, it will set a null value.

setValueSequenceCurrentback to summary
public ColumnConfig setValueSequenceCurrent(SequenceCurrentValueFunction valueSequenceCurrent)
setValueSequenceNextback to summary
public ColumnConfig setValueSequenceNext(SequenceNextValueFunction valueSequenceNext)
liquibase.change back to summary

public Class ColumnConfig.ValueNumeric

extends Number
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Number
private static final long
private final String

Constructor Summary

AccessConstructor and Description
public
ValueNumeric(final String value, final Number numeric)

Method Summary

Modifier and TypeMethod and Description
public double
doubleValue()

Implements abstract java.lang.Number.doubleValue.

Returns the value of the specified number as a double.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public float
floatValue()

Implements abstract java.lang.Number.floatValue.

Returns the value of the specified number as a float.

public Number
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public int
intValue()

Implements abstract java.lang.Number.intValue.

Returns the value of the specified number as an int.

public long
longValue()

Implements abstract java.lang.Number.longValue.

Returns the value of the specified number as a long.

private static ColumnConfig.ValueNumeric
of(Locale locale, String value)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Number:
byteValueshortValue

Field Detail

delegateback to summary
private final Number delegate
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Number.serialVersionUID.

valueback to summary
private final String value

Constructor Detail

ValueNumericback to summary
public ValueNumeric(final String value, final Number numeric)

Method Detail

doubleValueback to summary
public double doubleValue()

Implements abstract java.lang.Number.doubleValue.

Doc from java.lang.Number.doubleValue.

Returns the value of the specified number as a double.

Returns:double

the numeric value represented by this object after conversion to type double.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
floatValueback to summary
public float floatValue()

Implements abstract java.lang.Number.floatValue.

Doc from java.lang.Number.floatValue.

Returns the value of the specified number as a float.

Returns:float

the numeric value represented by this object after conversion to type float.

Annotations
@Override
getDelegateback to summary
public Number getDelegate()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
intValueback to summary
public int intValue()

Implements abstract java.lang.Number.intValue.

Doc from java.lang.Number.intValue.

Returns the value of the specified number as an int.

Returns:int

the numeric value represented by this object after conversion to type int.

Annotations
@Override
longValueback to summary
public long longValue()

Implements abstract java.lang.Number.longValue.

Doc from java.lang.Number.longValue.

Returns the value of the specified number as a long.

Returns:long

the numeric value represented by this object after conversion to type long.

Annotations
@Override
ofback to summary
private static ColumnConfig.ValueNumeric of(Locale locale, String value) throws ParseException
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