org.apache.torque

## Class ColumnImpl

- java.lang.Object
- - org.apache.torque.ColumnImpl

- All Implemented Interfaces:
    Serializable, Column

      public class ColumnImpl
      extends Object
      implements Column, Serializable

  An implementation of the column interface. This class is immutable, i.e cannot be changed once constructed.
  Version:
    $Id: ColumnImpl.java 1879929 2020-07-16 07:42:57Z gk $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColumnImpl(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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `String` | `getColumnName()` Returns the column name.
    `String` | `getFullTableName()` Returns the table name prefixed with the schema name if it exists.
    `String` | `getSchemaName()` Returns the name of any fixed schema prefix for the column's table (if any).
    `String` | `getSqlExpression()` Returns the SQL expression for the column, qualified by the table name but not by the schema name.
    `String` | `getTableName()` Returns the table name.
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ColumnImpl

          public ColumnImpl(String tableName,
                            String columnName)

      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

          public ColumnImpl(String schemaName,
                            String tableName,
                            String columnName)

      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

          public ColumnImpl(String schemaName,
                            String tableName,
                            String columnName,
                            String sqlExpression)

      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

          public ColumnImpl(String sqlExpression)

      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 Detail

    - #### getColumnName

          public String getColumnName()

      Returns the column name.
      Specified by:
        `getColumnName` in interface `Column`
      Returns:
        the column name, may be null.

    - #### getTableName

          public String getTableName()

      Returns the table name.
      Specified by:
        `getTableName` in interface `Column`
      Returns:
        the table name, may be null.

    - #### getFullTableName

          public String 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:
        `getFullTableName` in interface `Column`
      Returns:
        the fully qualified table name of the column, may be null but not blank.

    - #### getSchemaName

          public String getSchemaName()

      Returns the name of any fixed schema prefix for the column's table (if any).
      Specified by:
        `getSchemaName` in interface `Column`
      Returns:
        the schema name, or null if the schema is not known.

    - #### getSqlExpression

          public String 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:
        `getSqlExpression` in interface `Column`
      Returns:
        the SQL expression for the column, not null.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.