public class ColumnConfig extends AbstractLiquibaseSerializable
Modifier and Type | Class and Description |
---|---|
static class |
ColumnConfig.ValueNumeric |
LiquibaseSerializable.SerializationType
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
Constructor and Description |
---|
ColumnConfig()
Create am empty ColumnConfig object.
|
ColumnConfig(Column columnSnapshot)
Create a ColumnConfig object based on a
Column snapshot. |
Modifier and Type | Method and Description |
---|---|
static ColumnConfig[] |
arrayFromNames(String names) |
static ColumnConfig |
fromName(String name) |
Boolean |
getComputed() |
ConstraintsConfig |
getConstraints()
Returns the ConstraintsConfig this ColumnConfig is using.
|
Boolean |
getDefaultOnNull() |
String |
getDefaultValue()
The String default value to assign to this column.
|
Boolean |
getDefaultValueBoolean()
Return the boolean value this column should default to.
|
DatabaseFunction |
getDefaultValueComputed()
Return the function whose value should generate this column's default.
|
String |
getDefaultValueConstraintName() |
Date |
getDefaultValueDate()
Return the date value this column should default to.
|
Number |
getDefaultValueNumeric()
Return the numeric value this column should default to.
|
Object |
getDefaultValueObject()
Return the value to set this column's default to according to the setDefaultValue* function that was called.
|
SequenceNextValueFunction |
getDefaultValueSequenceNext() |
Boolean |
getDescending() |
String |
getEncoding()
Return encoding of a file, referenced via
valueClobFile . |
String |
getGenerationType() |
BigInteger |
getIncrementBy()
Return the amount to auto increment by.
|
String |
getName()
The name of the column.
|
String |
getRemarks()
Return the remarks to apply to this column.
|
LiquibaseSerializable.SerializationType |
getSerializableFieldType(String field) |
Object |
getSerializableFieldValue(String field) |
String |
getSerializedObjectName() |
String |
getSerializedObjectNamespace() |
BigInteger |
getStartWith()
Return the number to start auto incrementing with.
|
String |
getType()
The data type fof the column.
|
String |
getValue()
The String value to set this column to.
|
String |
getValueBlobFile()
Return the file containing the data to load into a BLOB.
|
Boolean |
getValueBoolean()
Return the boolean value this column should be set to.
|
String |
getValueClobFile()
Return the file containing the data to load into a CLOB.
|
DatabaseFunction |
getValueComputed()
Return the function this column should be set from.
|
Date |
getValueDate()
Return the date value this column should be set to.
|
Number |
getValueNumeric()
Return the numeric value this column should be set to.
|
Object |
getValueObject()
Return the value from whatever setValue* function was called.
|
SequenceCurrentValueFunction |
getValueSequenceCurrent() |
SequenceNextValueFunction |
getValueSequenceNext() |
boolean |
hasDefaultValue()
Returns true if any of the setDefaultValue* functions have had a non-null value set
|
Boolean |
isAutoIncrement()
Returns true if this Column should be set to be auto increment.
|
void |
load(ParsedNode parsedNode,
ResourceAccessor resourceAccessor) |
protected void |
loadConstraints(ParsedNode constraintsNode) |
ColumnConfig |
setAutoIncrement(Boolean autoIncrement) |
ColumnConfig |
setComputed(Boolean computed) |
ColumnConfig |
setConstraints(ConstraintsConfig constraints) |
ColumnConfig |
setDefaultOnNull(Boolean defaultOnNull) |
ColumnConfig |
setDefaultValue(String defaultValue)
Sets the string default value to assign to this column.
|
ColumnConfig |
setDefaultValueBoolean(Boolean defaultValueBoolean) |
ColumnConfig |
setDefaultValueBoolean(String defaultValueBoolean)
Set the defaultValueBoolean based on a given string.
|
ColumnConfig |
setDefaultValueComputed(DatabaseFunction defaultValueComputed) |
void |
setDefaultValueConstraintName(String defaultValueConstraintName) |
ColumnConfig |
setDefaultValueDate(Date defaultValueDate) |
ColumnConfig |
setDefaultValueDate(String defaultValueDate)
Set the date this column should default to.
|
ColumnConfig |
setDefaultValueNumeric(Number defaultValueNumeric) |
ColumnConfig |
setDefaultValueNumeric(String defaultValueNumeric)
Set the number this column should use as its default.
|
ColumnConfig |
setDefaultValueSequenceNext(SequenceNextValueFunction defaultValueSequenceNext) |
ColumnConfig |
setDescending(Boolean descending) |
ColumnConfig |
setEncoding(String encoding) |
ColumnConfig |
setGenerationType(String generationType) |
ColumnConfig |
setIncrementBy(BigInteger incrementBy) |
ColumnConfig |
setName(String name) |
ColumnConfig |
setName(String name,
boolean computed) |
ColumnConfig |
setRemarks(String remarks) |
ColumnConfig |
setStartWith(BigInteger startWith) |
ColumnConfig |
setType(String type) |
ColumnConfig |
setValue(String value)
Sets the string value this column should be set to.
|
ColumnConfig |
setValueBlobFile(String valueBlobFile) |
ColumnConfig |
setValueBoolean(Boolean valueBoolean) |
ColumnConfig |
setValueBoolean(String valueBoolean)
Set the valueBoolean based on a given string.
|
ColumnConfig |
setValueClobFile(String valueClobFile) |
ColumnConfig |
setValueComputed(DatabaseFunction valueComputed) |
ColumnConfig |
setValueDate(Date valueDate) |
ColumnConfig |
setValueDate(String valueDate)
Set the date this column should be set to.
|
ColumnConfig |
setValueNumeric(Number valueNumeric) |
ColumnConfig |
setValueNumeric(String valueNumeric)
Set the number this column should be set to.
|
ColumnConfig |
setValueSequenceCurrent(SequenceCurrentValueFunction valueSequenceCurrent) |
ColumnConfig |
setValueSequenceNext(SequenceNextValueFunction valueSequenceNext) |
convertEscaped, getSerializableFieldDataTypeClass, getSerializableFieldDataTypeClassParameters, getSerializableFieldNamespace, getSerializableFields, serialize, serializeValue, setSerializableFieldValue, shouldAutoLoad
public ColumnConfig(Column columnSnapshot)
Column
snapshot.
It will attempt to set as much as possible based on the information in the snapshot.public ColumnConfig()
public static ColumnConfig fromName(String name)
public static ColumnConfig[] arrayFromNames(String names)
public String getName()
public ColumnConfig setName(String name)
public ColumnConfig setName(String name, boolean computed)
public Boolean getComputed()
public ColumnConfig setComputed(Boolean computed)
public String getType()
DataTypeFactory.fromDescription(String, liquibase.database.Database)
before being included in SQL.public ColumnConfig setType(String type)
public String getValue()
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)public ColumnConfig setValue(String value)
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.public Number getValueNumeric()
setValue(String)
public ColumnConfig setValueNumeric(Number valueNumeric)
public ColumnConfig setValueNumeric(String valueNumeric)
public Boolean getValueBoolean()
setValue(String)
public ColumnConfig setValueBoolean(String valueBoolean)
public ColumnConfig setValueBoolean(Boolean valueBoolean)
public DatabaseFunction getValueComputed()
setValue(String)
public ColumnConfig setValueComputed(DatabaseFunction valueComputed)
public SequenceNextValueFunction getValueSequenceNext()
public ColumnConfig setValueSequenceNext(SequenceNextValueFunction valueSequenceNext)
public SequenceCurrentValueFunction getValueSequenceCurrent()
public ColumnConfig setValueSequenceCurrent(SequenceCurrentValueFunction valueSequenceCurrent)
public Date getValueDate()
setValue(String)
public ColumnConfig setValueDate(String valueDate) throws DateParseException
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.valueDate
- the Date Value to use (may be null or "null", or start with "now" or "today".DateParseException
- if the columnType isn't supported for "now" or "today" values.public ColumnConfig setValueDate(Date valueDate)
public String getValueBlobFile()
setValue(String)
public ColumnConfig setValueBlobFile(String valueBlobFile)
public String getValueClobFile()
setValue(String)
public ColumnConfig setValueClobFile(String valueClobFile)
public String getEncoding()
valueClobFile
.public ColumnConfig setEncoding(String encoding)
public Object getValueObject()
public String getDefaultValue()
setDefaultValue(String)
use a more specific function like getDefaultValueNumeric()
or the more generic getDefaultValueObject()
public ColumnConfig setDefaultValue(String defaultValue)
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.public Number getDefaultValueNumeric()
setDefaultValue(String)
public ColumnConfig setDefaultValueNumeric(String defaultValueNumeric)
public ColumnConfig setDefaultValueNumeric(Number defaultValueNumeric)
public Date getDefaultValueDate()
setDefaultValue(String)
public ColumnConfig setDefaultValueDate(Date defaultValueDate)
public ColumnConfig setDefaultValueDate(String defaultValueDate)
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.public Boolean getDefaultValueBoolean()
setDefaultValue(String)
public ColumnConfig setDefaultValueBoolean(String defaultValueBoolean)
public ColumnConfig setDefaultValueBoolean(Boolean defaultValueBoolean)
public DatabaseFunction getDefaultValueComputed()
setDefaultValue(String)
public ColumnConfig setDefaultValueComputed(DatabaseFunction defaultValueComputed)
public Object getDefaultValueObject()
public ConstraintsConfig getConstraints()
public ColumnConfig setConstraints(ConstraintsConfig constraints)
public Boolean isAutoIncrement()
public ColumnConfig setAutoIncrement(Boolean autoIncrement)
public BigInteger getStartWith()
public ColumnConfig setStartWith(BigInteger startWith)
public BigInteger getIncrementBy()
public ColumnConfig setIncrementBy(BigInteger incrementBy)
public boolean hasDefaultValue()
public String getRemarks()
public ColumnConfig setRemarks(String remarks)
public Boolean getDescending()
public ColumnConfig setDescending(Boolean descending)
public Boolean getDefaultOnNull()
public ColumnConfig setDefaultOnNull(Boolean defaultOnNull)
public String getGenerationType()
public ColumnConfig setGenerationType(String generationType)
public String getSerializedObjectName()
public SequenceNextValueFunction getDefaultValueSequenceNext()
public ColumnConfig setDefaultValueSequenceNext(SequenceNextValueFunction defaultValueSequenceNext)
public String getDefaultValueConstraintName()
public void setDefaultValueConstraintName(String defaultValueConstraintName)
public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)
getSerializableFieldType
in interface LiquibaseSerializable
getSerializableFieldType
in class AbstractLiquibaseSerializable
public String getSerializedObjectNamespace()
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
load
in interface LiquibaseSerializable
load
in class AbstractLiquibaseSerializable
ParsedNodeException
protected void loadConstraints(ParsedNode constraintsNode) throws ParsedNodeException
ParsedNodeException
public Object getSerializableFieldValue(String field)
getSerializableFieldValue
in interface LiquibaseSerializable
getSerializableFieldValue
in class AbstractLiquibaseSerializable
Copyright © 2023 Liquibase.org. All rights reserved.