Interface DbObject
- All Known Implementing Classes:
AbstractDbObject,Column,ForeignKey,Index,PrimaryKey,Schema,Sequence,Table
public interface DbObject
All database objects to be modelled for schema comparisons must implement this interface, examples of which include: schemas, tables, indexes, primary keys, foreign keys, sequences and columns.
- Author:
- Matt Ward
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(DbObjectVisitor visitor) Allows a visitor to be invoked against this DbObject.voiddiff(DbObject right, DiffContext ctx) Generate a report of differences between this object ('left') and another object ('right').getName()All items can be asked for their name, but it may be null.Get the parent object for which this object is a child.Type name, e.g.Retrieve the list of validators associated with this database object.booleanIs there at least one validator that assumes object-level validation that removes the requirement for reporting of differences for this object?booleanDoes the database object have any validators associated with it?booleanAre the twoDbObjects logically the same?voidSets the parent object.voidsetValidators(List<DbValidator> validators) Set/override the validators associated with this database object.
-
Method Details
-
sameAs
Are the twoDbObjects logically the same? For example two Index objects may have different names, but are the same index as they both index the same columns for the same table.If two objects a and b have the same logical identity, it does not mean that
a.equals(b) == true. The two objects may well have differences and will be flagged as such by the schema comparison tool. Whena.sameAs(b) == trueit makes it easier to show the differences as related, i.e. a and b are different rather than, a is only in the 'left' tree and b is only in the 'right' tree.- Parameters:
other- DbObject- Returns:
- boolean
-
getName
String getName()All items can be asked for their name, but it may be null.- Returns:
- Name if available, null otherwise.
-
diff
Generate a report of differences between this object ('left') and another object ('right'). Differences between the left and right objects under inspection are captured in theResultsobject passed in to this method.- Parameters:
right- The object to compare against.ctx- The DiffContext
-
accept
Allows a visitor to be invoked against this DbObject. Implementations should ensure that child objects are visited first (by calling accept on them) before invoking the visitor on itself.- Parameters:
visitor- DbObjectVisitor
-
getParent
DbObject getParent()Get the parent object for which this object is a child. If this is the root object then null should be returned.- Returns:
- Parent reference or null
-
setParent
Sets the parent object.- Parameters:
parent- DbObject- See Also:
-
getValidators
List<DbValidator> getValidators()Retrieve the list of validators associated with this database object.- Returns:
- DbValidator List
- See Also:
-
setValidators
Set/override the validators associated with this database object. -
hasValidators
boolean hasValidators()Does the database object have any validators associated with it?- Returns:
- true if there are one or more validators.
-
hasObjectLevelValidator
boolean hasObjectLevelValidator()Is there at least one validator that assumes object-level validation that removes the requirement for reporting of differences for this object?- Returns:
- boolean
-
getTypeName
String getTypeName()Type name, e.g. "column", "foreign key"- Returns:
- String
-