Package org.pgcodekeeper.core.schema.pg
Class PgCast
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.pg.PgCast
- All Implemented Interfaces:
IHashable,ICast,IStatement
PostgreSQL type cast implementation.
Represents a cast that specifies how to perform conversions between two data types.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.pgcodekeeper.core.schema.ICast
ICast.CastContext -
Field Summary
Fields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendAlterSQL(PgStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleancompare(PgStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.Gets the context in which this cast can be invoked.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.Gets the database that contains this statement.Gets the fully qualified name of this statement.Gets the source type of the cast.Gets the type of this database object.Gets the target type of the cast.voidsetContext(ICast.CastContext context) voidsetFunction(String function) voidsetMethod(PgCast.CastMethod method) Copies all object properties into a new object and leaves all its children empty.Methods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendComments, appendOwnerSQL, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getDbType, getDeps, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, isSubElement, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getName, getParent
-
Constructor Details
-
PgCast
Creates a new PostgreSQL cast.- Parameters:
source- source data typetarget- target data type
-
-
Method Details
-
getStatementType
Description copied from interface:IStatementGets the type of this database object.- Specified by:
getStatementTypein interfaceIStatement- Returns:
- the database object type
-
getContext
Description copied from interface:ICastGets the context in which this cast can be invoked.- Specified by:
getContextin interfaceICast- Returns:
- the cast context
-
setContext
-
setMethod
-
setFunction
-
getSource
Description copied from interface:ICastGets the source type of the cast. -
getTarget
Description copied from interface:ICastGets the target type of the cast. -
getDatabase
Description copied from interface:IStatementGets the database that contains this statement.- Specified by:
getDatabasein interfaceIStatement- Returns:
- the containing database
-
getQualifiedName
Description copied from interface:IStatementGets the fully qualified name of this statement.- Specified by:
getQualifiedNamein interfaceIStatement- Overrides:
getQualifiedNamein classPgStatement- Returns:
- fully qualified (up to schema) dot-delimited object name. Identifiers are quoted.
-
getCreationSQL
Description copied from class:PgStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Specified by:
getCreationSQLin classPgStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from class:PgStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin classPgStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
compare
Description copied from class:PgStatementThis method does not account for nested child PgStatements. Shallow version ofPgStatement.equals(Object)- Overrides:
comparein classPgStatement
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Parameters:
hasher- the hasher instance to use for hash computation
-
shallowCopy
Description copied from class:PgStatementCopies all object properties into a new object and leaves all its children empty.- Specified by:
shallowCopyin classPgStatement- Returns:
- shallow copy of a DB object.
-