Class JdbcTableColumn
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.jdbc.JdbcTableColumn
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,Serializable
Metadata for a column of a
JdbcTable, read from JDBC DatabaseMetaData by
JdbcConnection.loadTables(LoadTablesRequest).- See Also:
-
Field Summary
FieldsFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).intReturns the maximum length in bytes of a character column (JDBCCHAR_OCTET_LENGTH).Returns the fully-qualified class name of the values the JDBC driver returns for this column.intReturns the number of fractional digits (0 where not applicable).Returns the column's default value as unparsed text reported by the database, ornull.Converts the default value to a Java string literal suitable for code generation.Returns theFieldTypecorresponding to this column's Java type.Returns the bean getter name for this column, e.g.intgetIndex()Index of column in table (starting at 1).Class<?> Returns the Java type for the column's values, chosen from the connection's type overrides or SQL-to-Java type mapper.Returns theResultSetandPreparedStatementaccessor suffix for the Java type, e.g.getName()Returns the name as a camel-case Java class name, e.g.Returns the name as a camel-case Java identifier, e.g.Starting at 1.intgetRadix()Returns the radix of the size and decimals, typically 10 or 2.Returns the column's 1-based position in the table's best row identifier, ornullif it is not part of it.Returns the bean setter name for this column, e.g.intgetSize()Returns the column size: the precision for numbers, the length in characters for text and in bytes for binary data.intSQL type fromTypesgetTable()Returns the table this column was added to, ornull.booleanReturnstrueif values of this type are numbers that do not contain exact quantities (DOUBLE, FLOAT, or REAL).booleanbooleanReturnstrueif the SQL type is BLOB, BINARY, VARBINARY or LONGVARBINARY.booleanReturnstrueif the SQL type is BIT or BOOLEAN.booleanReturnstrueif the default value is an empty string or the string "''".booleanReturnstrueif values of this type are numbers that contain exact quantities (BIGINT, DECIMAL, INTEGER, NUMERIC, SMALLINT, TINYINT, SMALLINT).booleanIndicates if the column is a generated (computed) column.booleanReturnstrueif columns of this type are numbers that cannot contain fractions (byte, short, int, etc.).booleanIndicates if the column is known to allow nulls (false when the database reports no nulls or unknown).booleanReturnstrueif the default value isnullor the string "NULL".booleanReturnstrueif the SQL type is BIGINT, DECIMAL, DOUBLE, FLOAT, INTEGER, NUMERIC, REAL, SMALLINT or TINYINT.booleanbooleanisPseudo()Indicates if the column is a pseudo column, like an Oracle ROWID, reported as part of the best row identifier.booleanReturnstrueif columns of this type are numbers that can contain fractions.booleanReturnstrueif the column is part of the table's best row identifier (the columns that uniquely identify a row).booleanisSigned()booleanReturnstrueif the SQL type is DATE, TIME, TIMESTAMP, TIME_WITH_TIMEZONE or TIMESTAMP_WITH_TIMEZONE.booleanReturnstrueif the SQL type is CHAR, VARCHAR, LONGVARCHAR, their national (N) variants, CLOB or NCLOB.setAutoIncrement(boolean autoIncrement) setByteCount(int byteCount) Sets the maximum length in bytes of a character column (JDBCCHAR_OCTET_LENGTH).setClassName(String className) Sets the fully-qualified class name of the values the JDBC driver returns for this column.setDatabaseTypeName(String databaseTypeName) setDecimals(int decimals) Sets the number of fractional digits (0 where not applicable).setDefaultValue(String defaultValue) Sets the column's default value as unparsed text reported by the database.setGenerated(boolean generated) Indicates if the column is a generated (computed) column.setIndex(int index) Index of column in table (starting at 1).setJavaType(Class<?> javaType) Sets the Java type for the column's values, normally chosen when the table's columns are loaded.setNullable(boolean nullable) Indicates if the column is known to allow nulls (false when the database reports no nulls or unknown).setPrimaryKeySequence(Integer primaryKeySequence) Sets the column's 1-based position in the primary key, ornullif it is not part of it.setPseudo(boolean pseudo) Indicates if the column is a pseudo column, like an Oracle ROWID, reported as part of the best row identifier.setRadix(int radix) Sets the radix of the size and decimals, typically 10 or 2.setRemarks(String remarks) setRowIdentifierSequence(Integer rowIdentifierSequence) Sets the column's 1-based position in the table's best row identifier, ornullif it is not part of it.setSigned(boolean signed) setSize(int size) Sets the column size: the precision for numbers, the length in characters for text and in bytes for binary data.setSqlTypeIndex(int sqlTypeIndex) SQL type fromTypesprotected JdbcTableColumnSets the table this column belongs to; called byJdbcTable.addColumn(JdbcTableColumn).toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.Methods inherited from class com.northconcepts.datapipeline.foundations.core.Bean
addExceptionProperties, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties, exception, exception, exceptionMethods inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
fromJson, fromJson, toJson, toJson, toJsonMethods inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
fromXml, fromXml, fromXmlElement, toXml, toXml, toXml, toXml, toXml, toXmlElement
-
Field Details
-
NAME_COMPARATOR
-
-
Constructor Details
-
JdbcTableColumn
public JdbcTableColumn()
-
-
Method Details
-
getTable
Returns the table this column was added to, ornull. -
setTable
Sets the table this column belongs to; called byJdbcTable.addColumn(JdbcTableColumn). -
getName
-
setName
-
getNameAsJavaClassName
Returns the name as a camel-case Java class name, e.g.FirstNameforFIRST_NAME. -
getNameAsJavaIdentifier
Returns the name as a camel-case Java identifier, e.g.firstNameforFIRST_NAME. -
getSqlTypeIndex
public int getSqlTypeIndex()SQL type fromTypes -
setSqlTypeIndex
SQL type fromTypes -
isBinarySqlType
public boolean isBinarySqlType()Returnstrueif the SQL type is BLOB, BINARY, VARBINARY or LONGVARBINARY. -
isTextSqlType
public boolean isTextSqlType()Returnstrueif the SQL type is CHAR, VARCHAR, LONGVARCHAR, their national (N) variants, CLOB or NCLOB. -
isNumericSqlType
public boolean isNumericSqlType()Returnstrueif the SQL type is BIGINT, DECIMAL, DOUBLE, FLOAT, INTEGER, NUMERIC, REAL, SMALLINT or TINYINT. -
isBooleanSqlType
public boolean isBooleanSqlType()Returnstrueif the SQL type is BIT or BOOLEAN. -
isTemporalSqlType
public boolean isTemporalSqlType()Returnstrueif the SQL type is DATE, TIME, TIMESTAMP, TIME_WITH_TIMEZONE or TIMESTAMP_WITH_TIMEZONE. -
isRealNumber
public boolean isRealNumber()Returnstrueif columns of this type are numbers that can contain fractions. -
isIntegerNumber
public boolean isIntegerNumber()Returnstrueif columns of this type are numbers that cannot contain fractions (byte, short, int, etc.). -
isExactNumber
public boolean isExactNumber()Returnstrueif values of this type are numbers that contain exact quantities (BIGINT, DECIMAL, INTEGER, NUMERIC, SMALLINT, TINYINT, SMALLINT). -
isApproximateNumber
public boolean isApproximateNumber()Returnstrueif values of this type are numbers that do not contain exact quantities (DOUBLE, FLOAT, or REAL). -
getDatabaseTypeName
-
setDatabaseTypeName
-
getSize
public int getSize()Returns the column size: the precision for numbers, the length in characters for text and in bytes for binary data. -
setSize
Sets the column size: the precision for numbers, the length in characters for text and in bytes for binary data. -
getDecimals
public int getDecimals()Returns the number of fractional digits (0 where not applicable). -
setDecimals
Sets the number of fractional digits (0 where not applicable). -
getRadix
public int getRadix()Returns the radix of the size and decimals, typically 10 or 2. -
setRadix
Sets the radix of the size and decimals, typically 10 or 2. -
isNullable
public boolean isNullable()Indicates if the column is known to allow nulls (false when the database reports no nulls or unknown). -
setNullable
Indicates if the column is known to allow nulls (false when the database reports no nulls or unknown). -
getRemarks
-
setRemarks
-
getDefaultValue
Returns the column's default value as unparsed text reported by the database, ornull. -
setDefaultValue
Sets the column's default value as unparsed text reported by the database. -
isNullDefaultValue
public boolean isNullDefaultValue()Returnstrueif the default value isnullor the string "NULL".- Returns:
trueif the default value is null or "NULL",falseotherwise
-
isEmptyDefaultValue
public boolean isEmptyDefaultValue()Returnstrueif the default value is an empty string or the string "''".- Returns:
trueif the default value is empty or "''",falseotherwise
-
getDefaultValueAsJavaString
Converts the default value to a Java string literal suitable for code generation.Returns
nullif the default value is null or "NULL", returns""for empty strings, properly escapes text SQL types, and returns the default value as-is for primitive types. For non-primitive and non-string types, returnsnull.- Returns:
- the default value as a Java string literal, or
nullif not convertible
-
getByteCount
public int getByteCount()Returns the maximum length in bytes of a character column (JDBCCHAR_OCTET_LENGTH). -
setByteCount
Sets the maximum length in bytes of a character column (JDBCCHAR_OCTET_LENGTH). -
getIndex
public int getIndex()Index of column in table (starting at 1). -
setIndex
Index of column in table (starting at 1). -
isAutoIncrement
public boolean isAutoIncrement() -
setAutoIncrement
-
isGenerated
public boolean isGenerated()Indicates if the column is a generated (computed) column. -
setGenerated
Indicates if the column is a generated (computed) column. -
isPseudo
public boolean isPseudo()Indicates if the column is a pseudo column, like an Oracle ROWID, reported as part of the best row identifier. -
setPseudo
Indicates if the column is a pseudo column, like an Oracle ROWID, reported as part of the best row identifier. -
getJavaType
Returns the Java type for the column's values, chosen from the connection's type overrides or SQL-to-Java type mapper. -
setJavaType
Sets the Java type for the column's values, normally chosen when the table's columns are loaded. -
getFieldType
Returns theFieldTypecorresponding to this column's Java type.If the Java type cannot be mapped to a
FieldType, returnsFieldType.UNDEFINED.- Returns:
- the field type for this column, or
FieldType.UNDEFINEDif not mappable
-
getMethodSuffix
Returns theResultSetandPreparedStatementaccessor suffix for the Java type, e.g.IntforgetIntandsetInt. -
getGetterMethod
Returns the bean getter name for this column, e.g.getFirstName, orisActivefor a primitive boolean. -
getSetterMethod
Returns the bean setter name for this column, e.g.setFirstName. -
getPrimaryKeySequence
Starting at 1. -
setPrimaryKeySequence
Sets the column's 1-based position in the primary key, ornullif it is not part of it. -
isPrimaryKey
public boolean isPrimaryKey() -
getRowIdentifierSequence
Returns the column's 1-based position in the table's best row identifier, ornullif it is not part of it. -
setRowIdentifierSequence
Sets the column's 1-based position in the table's best row identifier, ornullif it is not part of it. -
isRowIdentifier
public boolean isRowIdentifier()Returnstrueif the column is part of the table's best row identifier (the columns that uniquely identify a row). -
getClassName
Returns the fully-qualified class name of the values the JDBC driver returns for this column. -
setClassName
Sets the fully-qualified class name of the values the JDBC driver returns for this column. -
isSigned
public boolean isSigned() -
setSigned
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classBean
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classBean- Parameters:
source-- Returns:
- this instance.
-