Package liquibase.structure
Interface DatabaseObject
- All Superinterfaces:
Comparable
,LiquibaseSerializable
- All Known Implementing Classes:
AbstractDatabaseObject
,Catalog
,Column
,Data
,ForeignKey
,Index
,LiquibaseColumn
,PrimaryKey
,Relation
,Schema
,Sequence
,StoredDatabaseLogic
,StoredProcedure
,Table
,UniqueConstraint
,View
Interface 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 using this interface are
Table
,
PrimaryKey
and Column
.
The most important abilities of every DatabaseObject are:
- Maintaining a list of attributes (key/value combinations representing the properties of a DatabaseObject) and methods to manipulate them
- Storing the full name of the object ([catalog and/or schema], object name etc.) to store the object in the database and retrieve it
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
Field Summary
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
-
Method Summary
Modifier and TypeMethodDescription<T> T
getAttribute
(String attribute, Class<T> type) Retrieves the value of aDatabaseObject
's attributes and cast it into the desired type.<T> T
getAttribute
(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
.getName()
setAttribute
(String attribute, Object value) Sets a given attribute for this object to the specified value.Sets the name for the database object.void
setSnapshotId
(String id) boolean
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface liquibase.serializer.LiquibaseSerializable
getSerializableFieldNamespace, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, getSerializedObjectName, getSerializedObjectNamespace, load, serialize
-
Method Details
-
getSnapshotId
String getSnapshotId() -
setSnapshotId
-
getContainingObjects
DatabaseObject[] getContainingObjects() -
getObjectTypeName
String getObjectTypeName() -
getName
String getName() -
setName
Sets the name for the database object.- Parameters:
name
- the new name for the database object- Returns:
- a reference to the same object (implementing classes are expected to return a reference to the same object).
-
getSchema
Schema getSchema() -
snapshotByDefault
boolean snapshotByDefault() -
getAttributes
Returns the name of all attributes currently stored for thisDatabaseObject
.- Returns:
- the Set of all attribute names
-
getAttribute
Retrieves the value of aDatabaseObject
's attributes and cast it into the desired type.- 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
RuntimeException
will occur.
-
getAttribute
Retrieves the value of aDatabaseObject
's attributes and cast it into the desired type.- 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
RuntimeException
will occur.
-
setAttribute
Sets a given attribute for this object to the specified value.- Parameters:
attribute
- case-sensitive name of the attributevalue
- value to be set- Returns:
- a reference to the same object
-