Top Description Fields Constructors Methods
liquibase.structure

public abstract Class AbstractDatabaseObject

extends Object
implements DatabaseObject
Class Inheritance
All Implemented Interfaces
liquibase.structure.DatabaseObject, liquibase.serializer.LiquibaseSerializable, java.lang.Comparable
Known Direct Subclasses
liquibase.structure.core.Catalog, liquibase.structure.core.Column, liquibase.structure.core.Data, liquibase.structure.core.ForeignKey, liquibase.structure.core.Index, liquibase.structure.core.PrimaryKey, liquibase.structure.core.Relation, liquibase.structure.core.Schema, liquibase.structure.core.Sequence, liquibase.structure.core.StoredDatabaseLogic, liquibase.structure.core.UniqueConstraint
Imports
liquibase.GlobalConfiguration, liquibase.exception.UnexpectedLiquibaseException, liquibase.parser.core.ParsedNode, .ParsedNodeException, liquibase.resource.ResourceAccessor, liquibase.serializer.LiquibaseSerializable, liquibase.structure.core.Column, .Schema, liquibase.util.ISODateFormat, .ObjectUtil, .StringUtil, java.util.*, java.util.regex.Matcher, .Pattern

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

Field Summary

Modifier and TypeField and Description
private final Map<String, Object>
public static final Pattern
private static final String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(Object
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public <T> T
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
)

Implements liquibase.structure.DatabaseObject.getAttribute, liquibase.structure.DatabaseObject.getAttribute.

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

public <T> T
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
)

Implements liquibase.structure.DatabaseObject.getAttribute.

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

public Set<String>
getAttributes()

Implements liquibase.structure.DatabaseObject.getAttributes.

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

public String
public String
public Set<String>
public LiquibaseSerializable.SerializationType
public Object
public String
public String
public String
public void
public ParsedNode
public DatabaseObject
setAttribute(String
case-sensitive name of the attribute
attribute
,
Object
value to be set
value
)

Implements liquibase.structure.DatabaseObject.setAttribute.

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

public void
public boolean

Returns:

true if the object types should include the catalog name in their specification, otherwise false.
shouldIncludeCatalogInSpecification
()

Returns a boolean value indicating whether the object types should include the catalog name in their specification.

public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attributesback to summary
private final Map<String, Object> attributes
CURLY_BRACKET_PATTERNback to summary
public static final Pattern CURLY_BRACKET_PATTERN
CURLY_BRACKET_REGEXback to summary
private static final String CURLY_BRACKET_REGEX
snapshotIdback to summary
private String snapshotId

Constructor Detail

AbstractDatabaseObjectback to summary
public AbstractDatabaseObject()

Method Detail

compareToback to summary
public int compareTo(Object o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:Object

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

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

Implements liquibase.structure.DatabaseObject.getAttribute, liquibase.structure.DatabaseObject.getAttribute.

Doc from liquibase.structure.DatabaseObject.getAttribute.

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.
Annotations
@Override
@SuppressWarnings:unchecked
getAttributeback to summary
public <T> T getAttribute(String attribute, T defaultValue)

Implements liquibase.structure.DatabaseObject.getAttribute.

Doc from liquibase.structure.DatabaseObject.getAttribute.

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.
Annotations
@Override
@SuppressWarnings:unchecked
getAttributesback to summary
public Set<String> getAttributes()

Implements liquibase.structure.DatabaseObject.getAttributes.

Doc from liquibase.structure.DatabaseObject.getAttributes.

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

Returns:Set<String>

the Set of all attribute names

Annotations
@Override
getObjectTypeNameback to summary
public String getObjectTypeName()

Implements liquibase.structure.DatabaseObject.getObjectTypeName.

Annotations
@Override
getSerializableFieldNamespaceback to summary
public String getSerializableFieldNamespace(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldNamespace.

Annotations
@Override
getSerializableFieldsback to summary
public Set<String> getSerializableFields()

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFields.

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

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldType.

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

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
getSnapshotIdback to summary
public String getSnapshotId()

Implements liquibase.structure.DatabaseObject.getSnapshotId.

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

Implements liquibase.serializer.LiquibaseSerializable.load.

Annotations
@Override
serializeback to summary
public ParsedNode serialize()

Implements liquibase.serializer.LiquibaseSerializable.serialize.

Annotations
@Override
setAttributeback to summary
public DatabaseObject setAttribute(String attribute, Object value)

Implements liquibase.structure.DatabaseObject.setAttribute.

Doc from liquibase.structure.DatabaseObject.setAttribute.

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

Annotations
@Override
setSnapshotIdback to summary
public void setSnapshotId(String snapshotId)

Implements liquibase.structure.DatabaseObject.setSnapshotId.

Annotations
@Override
shouldIncludeCatalogInSpecificationback to summary
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 the INCLUDE_CATALOG_IN_SPECIFICATION setting in the GlobalConfiguration.

Returns:boolean

true if the object types should include the catalog name in their specification, otherwise false.

snapshotByDefaultback to summary
public boolean snapshotByDefault()

Implements liquibase.structure.DatabaseObject.snapshotByDefault.

Annotations
@Override
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