Package liquibase.structure
Class AbstractDatabaseObject
java.lang.Object
liquibase.structure.AbstractDatabaseObject
- All Implemented Interfaces:
Comparable,LiquibaseSerializable,DatabaseObject
- Direct Known Subclasses:
Catalog,Column,Data,ForeignKey,Index,PrimaryKey,Relation,Schema,Sequence,StoredDatabaseLogic,UniqueConstraint
Template class for all types of database objects can be manipulated using ChangeSets. Objects represented by
subclasses are not specific to any RDBMS and thus only contain "high-level" properties that can be found in most
DBMS. Examples for things that are represented are
Table,
PrimaryKey and Column.
Core features of this class include the functionality for the attributes collection ( getAttributes() )
and the ability to load an object from a serialised form load(ParsedNode, ResourceAccessor) .-
Nested Class Summary
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType -
Field Summary
FieldsFields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint<T> TgetAttribute(String attribute, Class<T> type) Retrieves the value of aDatabaseObject's attributes and cast it into the desired type.<T> TgetAttribute(String attribute, T defaultValue) Retrieves the value of aDatabaseObject's attributes and cast it into the desired type.Returns the name of all attributes currently stored for thisDatabaseObject.getSerializableFieldType(String field) getSerializableFieldValue(String field) voidload(ParsedNode parsedNode, ResourceAccessor resourceAccessor) setAttribute(String attribute, Object value) Sets a given attribute for this object to the specified value.voidsetSnapshotId(String snapshotId) booleanReturns a boolean value indicating whether the object types should include the catalog name in their specification.booleantoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface liquibase.structure.DatabaseObject
getContainingObjects, getName, getSchema, setName
-
Field Details
-
CURLY_BRACKET_PATTERN
-
-
Constructor Details
-
AbstractDatabaseObject
public AbstractDatabaseObject()
-
-
Method Details
-
getObjectTypeName
- Specified by:
getObjectTypeNamein interfaceDatabaseObject
-
getSnapshotId
- Specified by:
getSnapshotIdin interfaceDatabaseObject
-
setSnapshotId
- Specified by:
setSnapshotIdin interfaceDatabaseObject
-
snapshotByDefault
public boolean snapshotByDefault()- Specified by:
snapshotByDefaultin interfaceDatabaseObject
-
compareTo
- Specified by:
compareToin interfaceComparable
-
getAttributes
Description copied from interface:DatabaseObjectReturns the name of all attributes currently stored for thisDatabaseObject.- Specified by:
getAttributesin interfaceDatabaseObject- Returns:
- the Set of all attribute names
-
getAttribute
Description copied from interface:DatabaseObjectRetrieves the value of aDatabaseObject's attributes and cast it into the desired type.- Specified by:
getAttributein interfaceDatabaseObject- Type Parameters:
T- the desired type of the value- Parameters:
attribute- case-sensitive name of the attribute for which the value will be retrievedtype- class compatible with the desired type T of the return value- Returns:
- if the attribute name exists, and the current value can be cast into the desired class, then the value is returned in the desired form. Note that null is a valid value, too.
- if the attribute name does not exist, null is returned.
- if the attribute has a value, but that value cannot be cast into the desired class, a
RuntimeExceptionwill occur.
-
getAttribute
Description copied from interface:DatabaseObjectRetrieves the value of aDatabaseObject's attributes and cast it into the desired type.- Specified by:
getAttributein interfaceDatabaseObject- Type Parameters:
T- the desired type of the value- Parameters:
attribute- case-sensitive name of the attribute for which the value will be retrieveddefaultValue- the value to be returned if no value (not even null) is stored for the attribute name in the object.- Returns:
- if the attribute name exists, and the current value can be cast into a type compatible with T, then value is returned in the desired form. Note that null is a valid value, too.
- if the attribute name does not exist, defaultValue is returned.
- if the attribute has a value, but that value cannot be cast into a type compatible with T, a
RuntimeExceptionwill occur.
-
setAttribute
Description copied from interface:DatabaseObjectSets a given attribute for this object to the specified value.- Specified by:
setAttributein interfaceDatabaseObject- Parameters:
attribute- case-sensitive name of the attributevalue- value to be set- Returns:
- a reference to the same object
-
getSerializedObjectName
- Specified by:
getSerializedObjectNamein interfaceLiquibaseSerializable
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespacein interfaceLiquibaseSerializable
-
getSerializableFieldNamespace
- Specified by:
getSerializableFieldNamespacein interfaceLiquibaseSerializable
-
getSerializableFields
- Specified by:
getSerializableFieldsin interfaceLiquibaseSerializable
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValuein interfaceLiquibaseSerializable
-
getSerializableFieldType
- Specified by:
getSerializableFieldTypein interfaceLiquibaseSerializable
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Specified by:
loadin interfaceLiquibaseSerializable- Throws:
ParsedNodeException
-
serialize
- Specified by:
serializein interfaceLiquibaseSerializable
-
toString
-
shouldIncludeCatalogInSpecification
public boolean shouldIncludeCatalogInSpecification()Returns a boolean value indicating whether the object types should include the catalog name in their specification. This method checks the current value of theINCLUDE_CATALOG_IN_SPECIFICATIONsetting in theGlobalConfiguration.- Returns:
trueif the object types should include the catalog name in their specification, otherwisefalse.
-