Top Description Fields Methods
liquibase.structure

public Interface DatabaseObject

extends Comparable, LiquibaseSerializable
Known Direct Implementers
liquibase.structure.AbstractDatabaseObject
Imports
liquibase.serializer.LiquibaseSerializable, liquibase.structure.core.Schema, java.util.Set

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 liquibase.structure.core.Table, liquibase.structure.core.PrimaryKey and liquibase.structure.core.Column.

The most important abilities of every DatabaseObject are:

See Also
AbstractDatabaseObject

Field Summary

Inherited from liquibase.serializer.LiquibaseSerializable:
GENERIC_CHANGELOG_EXTENSION_NAMESPACEGENERIC_SNAPSHOT_EXTENSION_NAMESPACESTANDARD_CHANGELOG_NAMESPACESTANDARD_SNAPSHOT_NAMESPACE

Method Summary

Modifier and TypeMethod and Description
public <
the desired type of the value
T
>
T

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
(String
case-sensitive name of the attribute for which the value will be retrieved
attribute
,
Class<T>
class compatible with the desired type T of the return value
type
)

Retrieves the value of a DatabaseObject's attributes and cast it into the desired type.

public <
the desired type of the value
T
>
T

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.
getAttribute
(String
case-sensitive name of the attribute for which the value will be retrieved
attribute
,
T
the value to be returned if no value (not even null) is stored for the attribute name in the object.
defaultValue
)

Retrieves the value of a DatabaseObject's attributes and cast it into the desired type.

public Set<String>

Returns:

the Set of all attribute names
getAttributes
()

Returns the name of all attributes currently stored for this DatabaseObject.

public DatabaseObject[]
public String
public String
public Schema
public String
public DatabaseObject

Returns:

a reference to the same object
setAttribute
(String
case-sensitive name of the attribute
attribute
,
Object
value to be set
value
)

Sets a given attribute for this object to the specified value.

public DatabaseObject

Returns:

a reference to the same object (implementing classes are expected to return a reference to the same object).
setName
(String
the new name for the database object
name
)

Sets the name for the database object.

public void
public boolean
Inherited from java.lang.Comparable:
compareTo
Inherited from liquibase.serializer.LiquibaseSerializable:
getSerializableFieldNamespacegetSerializableFieldsgetSerializableFieldTypegetSerializableFieldValuegetSerializedObjectNamegetSerializedObjectNamespaceloadserialize

Method Detail

getAttributeback to summary
public <T> T getAttribute(String attribute, Class<T> type)

Retrieves the value of a DatabaseObject's attributes and cast it into the desired type.

Parameters
<T>
the desired type of the value
attribute:String

case-sensitive name of the attribute for which the value will be retrieved

type:Class<T>

class compatible with the desired type T of the return value

Returns:T

  • 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.
getAttributeback to summary
public <T> T getAttribute(String attribute, T defaultValue)

Retrieves the value of a DatabaseObject's attributes and cast it into the desired type.

Parameters
<T>
the desired type of the value
attribute:String

case-sensitive name of the attribute for which the value will be retrieved

defaultValue:T

the value to be returned if no value (not even null) is stored for the attribute name in the object.

Returns:T

  • 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.
getAttributesback to summary
public Set<String> getAttributes()

Returns the name of all attributes currently stored for this DatabaseObject.

Returns:Set<String>

the Set of all attribute names

getContainingObjectsback to summary
public DatabaseObject[] getContainingObjects()
getNameback to summary
public String getName()
getObjectTypeNameback to summary
public String getObjectTypeName()
getSchemaback to summary
public Schema getSchema()
getSnapshotIdback to summary
public String getSnapshotId()
setAttributeback to summary
public DatabaseObject setAttribute(String attribute, Object value)

Sets a given attribute for this object to the specified value.

Parameters
attribute:String

case-sensitive name of the attribute

value:Object

value to be set

Returns:DatabaseObject

a reference to the same object

setNameback to summary
public DatabaseObject setName(String name)

Sets the name for the database object.

Parameters
name:String

the new name for the database object

Returns:DatabaseObject

a reference to the same object (implementing classes are expected to return a reference to the same object).

setSnapshotIdback to summary
public void setSnapshotId(String id)
snapshotByDefaultback to summary
public boolean snapshotByDefault()