Class GcTableSyncColumnMetadata
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintlength of string colsintcolumn index zero indexedname of columntype of columnintprecision of number in databaseintgetScale()scale of number in databaseinthashCode()booleantrue if this column is a SQL DATE (i.e. has no time part) as opposed to a SQL TIMESTAMPstatic BigDecimalnormalizeBigDecimal(BigDecimal bigDecimal) Normalize a BigDecimal so that numerically equal values are also equal by equals().normalizeValue(Object input) Convert a value to the canonical java type for this column so that values which come from different places can be compared with equals()/hashCode().voidsetColumnDisplaySize(int stringLength1) length of string colsvoidsetColumnIndexZeroIndexed(int columnIndexZeroIndexed1) voidsetColumnName(String columnName1) name of columnvoidsetColumnType(GcTableSyncColumnMetadata.ColumnType columnType1) type of columnvoidsetDateOnly(boolean dateOnly1) true if this column is a SQL DATE (i.e. has no time part) as opposed to a SQL TIMESTAMPvoidsetPrecision(int precision1) precision of number in databasevoidsetScale(int scale1) scale of number in databasetoString()
-
Constructor Details
-
GcTableSyncColumnMetadata
public GcTableSyncColumnMetadata()
-
-
Method Details
-
hashCode
public int hashCode() -
toString
-
equals
-
normalizeBigDecimal
Normalize a BigDecimal so that numerically equal values are also equal by equals(). e.g. 5, 5.0, and 5.00 all become 5. Note that BigDecimal.equals() and BigDecimal.hashCode() are scale sensitive, and those are what the table sync compares are based on.
- Parameters:
bigDecimal-- Returns:
- the normalized big decimal
-
normalizeValue
Convert a value to the canonical java type for this column so that values which come from different places can be compared with equals()/hashCode(). The two sides of a sync can be different database vendors (and therefore different jdbc drivers), or one side can be java objects passed in programmatically (e.g. GcTableSyncFromData), so the same logical value can arrive as an Integer, a Long, a BigDecimal, a String, a java.util.Date, etc. Without this the compare reports a difference and the row is updated on every run.
This is best effort and never throws. If the value cannot be converted it is returned unchanged so that behavior does not regress for types which are not handled here.
- Parameters:
input-- Returns:
- the normalized value
-
isDateOnly
public boolean isDateOnly()true if this column is a SQL DATE (i.e. has no time part) as opposed to a SQL TIMESTAMP- Returns:
- the dateOnly
-
setDateOnly
public void setDateOnly(boolean dateOnly1) true if this column is a SQL DATE (i.e. has no time part) as opposed to a SQL TIMESTAMP- Parameters:
dateOnly1- the dateOnly to set
-
getColumnIndexZeroIndexed
public int getColumnIndexZeroIndexed()column index zero indexed- Returns:
- the columnIndexZeroIndexed
-
setColumnIndexZeroIndexed
public void setColumnIndexZeroIndexed(int columnIndexZeroIndexed1) - Parameters:
columnIndexZeroIndexed1- the columnIndexZeroIndexed to set
-
getPrecision
public int getPrecision()precision of number in database- Returns:
- the precision
-
setPrecision
public void setPrecision(int precision1) precision of number in database- Parameters:
precision1- the precision to set
-
getScale
public int getScale()scale of number in database- Returns:
- the scale
-
setScale
public void setScale(int scale1) scale of number in database- Parameters:
scale1- the scale to set
-
getColumnDisplaySize
public int getColumnDisplaySize()length of string cols- Returns:
- the stringLength
-
setColumnDisplaySize
public void setColumnDisplaySize(int stringLength1) length of string cols- Parameters:
stringLength1- the stringLength to set
-
getColumnType
type of column- Returns:
- the columnType
-
setColumnType
type of column- Parameters:
columnType1- the columnType to set
-
getColumnName
name of column- Returns:
- the columnName
-
setColumnName
name of column- Parameters:
columnName1- the columnName to set
-