public abstract class AbstractDatabaseObject extends Object implements DatabaseObject
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)
.LiquibaseSerializable.SerializationType
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
Constructor and Description |
---|
AbstractDatabaseObject() |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object o) |
<T> T |
getAttribute(String attribute,
Class<T> type)
Retrieves the value of a
DatabaseObject 's attributes and cast it into the desired type. |
<T> T |
getAttribute(String attribute,
T defaultValue)
Retrieves the value of a
DatabaseObject 's attributes and cast it into the desired type. |
Set<String> |
getAttributes()
Returns the name of all attributes currently stored for this
DatabaseObject . |
String |
getObjectTypeName() |
String |
getSerializableFieldNamespace(String field) |
Set<String> |
getSerializableFields() |
LiquibaseSerializable.SerializationType |
getSerializableFieldType(String field) |
Object |
getSerializableFieldValue(String field) |
String |
getSerializedObjectName() |
String |
getSerializedObjectNamespace() |
String |
getSnapshotId() |
void |
load(ParsedNode parsedNode,
ResourceAccessor resourceAccessor) |
ParsedNode |
serialize() |
DatabaseObject |
setAttribute(String attribute,
Object value)
Sets a given attribute for this object to the specified value.
|
void |
setSnapshotId(String snapshotId) |
boolean |
shouldIncludeCatalogInSpecification()
Convenience method to check if the object types should consider catalog name
also during comparison (equals(), hashcode() and compareTo())
|
boolean |
snapshotByDefault() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getContainingObjects, getName, getSchema, setName
public String getObjectTypeName()
getObjectTypeName
in interface DatabaseObject
public String getSnapshotId()
getSnapshotId
in interface DatabaseObject
public void setSnapshotId(String snapshotId)
setSnapshotId
in interface DatabaseObject
public boolean snapshotByDefault()
snapshotByDefault
in interface DatabaseObject
public int compareTo(Object o)
compareTo
in interface Comparable
public Set<String> getAttributes()
DatabaseObject
DatabaseObject
.getAttributes
in interface DatabaseObject
public <T> T getAttribute(String attribute, Class<T> type)
DatabaseObject
DatabaseObject
's attributes and cast it into the desired type.getAttribute
in interface DatabaseObject
T
- the desired type of the valueattribute
- case-sensitive name of the attribute for which the value will be retrievedtype
- class compatible with the desired type T of the return valueRuntimeException
will occur.public <T> T getAttribute(String attribute, T defaultValue)
DatabaseObject
DatabaseObject
's attributes and cast it into the desired type.getAttribute
in interface DatabaseObject
T
- the desired type of the valueattribute
- 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.RuntimeException
will occur.public DatabaseObject setAttribute(String attribute, Object value)
DatabaseObject
setAttribute
in interface DatabaseObject
attribute
- case-sensitive name of the attributevalue
- value to be setpublic String getSerializedObjectName()
getSerializedObjectName
in interface LiquibaseSerializable
public String getSerializedObjectNamespace()
getSerializedObjectNamespace
in interface LiquibaseSerializable
public String getSerializableFieldNamespace(String field)
getSerializableFieldNamespace
in interface LiquibaseSerializable
public Set<String> getSerializableFields()
getSerializableFields
in interface LiquibaseSerializable
public Object getSerializableFieldValue(String field)
getSerializableFieldValue
in interface LiquibaseSerializable
public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)
getSerializableFieldType
in interface LiquibaseSerializable
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
load
in interface LiquibaseSerializable
ParsedNodeException
public ParsedNode serialize()
serialize
in interface LiquibaseSerializable
public boolean shouldIncludeCatalogInSpecification()
Copyright © 2023 Liquibase.org. All rights reserved.