Package org.apache.torque
Class ColumnImpl
java.lang.Object
org.apache.torque.ColumnImpl
- All Implemented Interfaces:
Serializable,Column
An implementation of the column interface.
This class is immutable, i.e cannot be changed once constructed.
- Version:
- $Id: ColumnImpl.java 1917245 2024-04-21 14:06:23Z tv $
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionColumnImpl(String sqlExpression) Constructor which tries to guess schema, table and column names from an SQL expression.ColumnImpl(String tableName, String columnName) Constructor.ColumnImpl(String schemaName, String tableName, String columnName) Constructor.ColumnImpl(String schemaName, String tableName, String columnName, String sqlExpression) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the column name.Returns the table name prefixed with the schema name if it exists.Returns the name of any fixed schema prefix for the column's table (if any).Returns the SQL expression for the column, qualified by the table name but not by the schema name.Returns the table name.inthashCode()toString()
-
Constructor Details
-
ColumnImpl
Constructor.- Parameters:
tableName- the table name, not null or blank.columnName- the column name, not null or blank.- Throws:
NullPointerException- if columnName or tableName are null.IllegalArgumentException- if columnName or tableName are blank.
-
ColumnImpl
Constructor.- Parameters:
schemaName- the schema name, may be null but not blank.tableName- the table name, may be null but not blank. If it contains a dot, then only the portion after the dot will be taken as table name. If it contains a dot and schemaName is null, then the schema name will be set as the portion before the dot.columnName- the column name, not null or blank.- Throws:
NullPointerException- if columnName or tableName are null.IllegalArgumentException- if columnName or tableName are blank.
-
ColumnImpl
Constructor.- Parameters:
schemaName- the schema name, may be null but not blank.tableName- the table name, may be null but not blank. If it contains a dot, then only the portion after the dot will be taken as table name. If it contains a dot and schemaName is null, then the schema name will be set as the portion before the dot.columnName- the column name, may be null but not blank.sqlExpression- the SQL expression for the column, not null or blank.- Throws:
NullPointerException- if tableName or sqlExpression are null.IllegalArgumentException- if tableName or sqlExpression are blank.
-
ColumnImpl
Constructor which tries to guess schema, table and column names from an SQL expression. If a schema name can be identified in the SQL expression, it is removed from the SQL expression in the column.- Parameters:
sqlExpression- the SQL expression, not null, not blank.- Throws:
NullPointerException- if sqlExpression is null.IllegalArgumentException- if table or column name cannot be guessed from sqlExpression.
-
-
Method Details
-
getColumnName
Returns the column name.- Specified by:
getColumnNamein interfaceColumn- Returns:
- the column name, may be null.
-
getTableName
Returns the table name.- Specified by:
getTableNamein interfaceColumn- Returns:
- the table name, may be null.
-
getFullTableName
Returns the table name prefixed with the schema name if it exists. I.e. if a schema name exists, the result will be schemaName.tableName, and otherwise it will just be tableName.- Specified by:
getFullTableNamein interfaceColumn- Returns:
- the fully qualified table name of the column, may be null but not blank.
-
getSchemaName
Returns the name of any fixed schema prefix for the column's table (if any).- Specified by:
getSchemaNamein interfaceColumn- Returns:
- the schema name, or null if the schema is not known.
-
getSqlExpression
Returns the SQL expression for the column, qualified by the table name but not by the schema name. This can also be a pseudocolumn (e.g. count(*)).- Specified by:
getSqlExpressionin interfaceColumn- Returns:
- the SQL expression for the column, not null.
-
hashCode
public int hashCode() -
equals
-
toString
-