org.springframework.data.relational.core.sql

## Class Column

- java.lang.Object
- - org.springframework.data.relational.core.sql.Column

All Implemented Interfaces:
  Expression, Named, Segment, Visitable

    public class Column
    extends Object
    implements Expression, Named

Column name within a `SELECT … FROM` clause.

Renders to: `<name>` or `<table(alias)>.<name>`.

Since:
  1.1
Author:
  Mark Paluch, Jens Schauder

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Column` `aliased(String name, Table table, String alias)` Creates a new aliased `Column` associated with a `Table`.
`Column` `as(SqlIdentifier alias)` Creates a new aliased `Column`.
`Column` `as(String alias)` Creates a new aliased `Column`.
`Between` `between(Expression begin, Expression end)` Creates a `BETWEEN` `Condition`.
`static Column` `create(SqlIdentifier name, Table table)` Creates a new `Column` associated with a `Table`.
`static Column` `create(String name, Table table)` Creates a new `Column` associated with a `Table`.
`boolean` `equals(Object obj)` Check whether this `Segment` is equal to another `Segment`.
`Column` `from(Table table)` Creates a new `Column` associated with a `Table`.
`SqlIdentifier` `getName()`
`SqlIdentifier` `getReferenceName()`
`Table` `getTable()`
`int` `hashCode()` Generate a hash code from this`Segment`.
`In` `in(Expression... expression)` Creates a new `In` `Condition` given right `Expression`s.
`In` `in(Select subselect)` Creates a new `In` `Condition` given a subselects.
`Comparison` `isEqualTo(Expression expression)` Creates a `=` (equals) `Condition`.
`Comparison` `isGreater(Expression expression)` Creates a {@code !
`Comparison` `isGreaterOrEqualTo(Expression expression)` Creates a `<=` (greater or equal to) `Condition`.
`Comparison` `isLess(Expression expression)` Creates a `<` (less) `Condition`.
`Comparison` `isLessOrEqualTo(Expression expression)` CCreates a `<=` (greater) `Condition`.
`Comparison` `isNotEqualTo(Expression expression)` Creates a {@code !
`Condition` `isNotNull()` Creates a `IS NOT NULL` condition.
`IsNull` `isNull()` Creates a `IS NULL` condition.
`Like` `like(Expression expression)` Creates a `LIKE` `Condition`.
`Between` `notBetween(Expression begin, Expression end)` Creates a `NOT BETWEEN` `Condition`.
`In` `notIn(Expression... expression)` Creates a new `not` `In` `Condition` given right `Expression`s.
`In` `notIn(Select subselect)` Creates a new `not` `In` `Condition` given a subselects.
`Like` `notLike(Expression expression)` Creates a `NOT LIKE` `Condition`.
`AssignValue` `set(Expression value)` Creates a value `assignment`.
`String` `toString()` Return a SQL string representation of this `Segment`.
`void` `visit(Visitor visitor)` Accept a `Visitor` visiting this `Visitable` and its nested `Visitable`s if applicable.

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

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

### Methods inherited from interface org.springframework.data.relational.core.sql.Segment

`equals, hashCode`

### Methods inherited from interface org.springframework.data.relational.core.sql.Visitable

`visit`

### Method Detail

#### create

    public static Column create(String name,
                                Table table)

Creates a new `Column` associated with a `Table`.

Parameters:
  `name` - column name, must not null or empty.
  `table` - the table, must not be null.
Returns:
  the new `Column`.

#### create

    public static Column create(SqlIdentifier name,
                                Table table)

Creates a new `Column` associated with a `Table`.

Parameters:
  `name` - column name, must not null.
  `table` - the table, must not be null.
Returns:
  the new `Column`.
Since:
  2.0

#### aliased

    public static Column aliased(String name,
                                 Table table,
                                 String alias)

Creates a new aliased `Column` associated with a `Table`.

Parameters:
  `name` - column name, must not null or empty.
  `table` - the table, must not be null.
  `alias` - column alias name, must not null or empty.
Returns:
  the new `Column`.

#### as

    public Column as(String alias)

Creates a new aliased `Column`.

Parameters:
  `alias` - column alias name, must not null or empty.
Returns:
  the aliased `Column`.

#### as

    public Column as(SqlIdentifier alias)

Creates a new aliased `Column`.

Parameters:
  `alias` - column alias name, must not null.
Returns:
  the aliased `Column`.
Since:
  2.0

#### from

    public Column from(Table table)

Creates a new `Column` associated with a `Table`.

Parameters:
  `table` - the table, must not be null.
Returns:
  a new `Column` associated with `Table`.

#### isEqualTo

    public Comparison isEqualTo(Expression expression)

Creates a `=` (equals) `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isNotEqualTo

    public Comparison isNotEqualTo(Expression expression)

Creates a `!=` (not equals) `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### between

    public Between between(Expression begin,
                           Expression end)

Creates a `BETWEEN` `Condition`.

Parameters:
  `begin` - begin value for the comparison.
  `end` - end value for the comparison.
Returns:
  the `Between` condition.
Since:
  2.0

#### notBetween

    public Between notBetween(Expression begin,
                              Expression end)

Creates a `NOT BETWEEN` `Condition`.

Parameters:
  `begin` - begin value for the comparison.
  `end` - end value for the comparison.
Returns:
  the `Between` condition.
Since:
  2.0

#### isLess

    public Comparison isLess(Expression expression)

Creates a `<` (less) `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isLessOrEqualTo

    public Comparison isLessOrEqualTo(Expression expression)

CCreates a `<=` (greater) `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isGreater

    public Comparison isGreater(Expression expression)

Creates a `!=` (not equals) `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### isGreaterOrEqualTo

    public Comparison isGreaterOrEqualTo(Expression expression)

Creates a `<=` (greater or equal to) `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Comparison` condition.

#### like

    public Like like(Expression expression)

Creates a `LIKE` `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Like` condition.

#### notLike

    public Like notLike(Expression expression)

Creates a `NOT LIKE` `Condition`.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `Like` condition.
Since:
  2.0

#### in

    public In in(Expression... expression)

Creates a new `In` `Condition` given right `Expression`s.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `In` condition.

#### in

    public In in(Select subselect)

Creates a new `In` `Condition` given a subselects.

Parameters:
  `subselect` - right side of the comparison.
Returns:
  the `In` condition.

#### notIn

    public In notIn(Expression... expression)

Creates a new `not` `In` `Condition` given right `Expression`s.

Parameters:
  `expression` - right side of the comparison.
Returns:
  the `In` condition.

#### notIn

    public In notIn(Select subselect)

Creates a new `not` `In` `Condition` given a subselects.

Parameters:
  `subselect` - right side of the comparison.
Returns:
  the `In` condition.

#### isNull

    public IsNull isNull()

Creates a `IS NULL` condition.

Returns:
  the `IsNull` condition.

#### isNotNull

    public Condition isNotNull()

Creates a `IS NOT NULL` condition.

Returns:
  the `Condition` condition.

#### set

    public AssignValue set(Expression value)

Creates a value `assignment`.

Parameters:
  `value` - the value to assign.
Returns:
  the `AssignValue` assignment.

#### getName

    public SqlIdentifier getName()

Specified by:
  `getName` in interface `Named`
Returns:
  the name of the underlying element.

#### getReferenceName

    public SqlIdentifier getReferenceName()

Returns:
  the column name as it is used in references. This can be the actual `name` or an `alias`.

#### getTable

    @Nullable
    public Table getTable()

Returns:
  the `Table`. Can be null if the column was not referenced in the context of a `Table`.

#### toString

    public String toString()

Description copied from interface: `Segment`
Return a SQL string representation of this `Segment`.

The representation is intended for debugging purposes and an approximation to the generated SQL. While it might work in the context of a specific dialect, you should not that the `Segment.toString()` representation works across multiple databases.

Specified by:
  `toString` in interface `Segment`
Overrides:
  `toString` in class `Object`
Returns:
  a SQL string representation of this `Segment`.

#### visit

    public void visit(Visitor visitor)

Description copied from interface: `Visitable`
Accept a `Visitor` visiting this `Visitable` and its nested `Visitable`s if applicable.

Specified by:
  `visit` in interface `Visitable`
Parameters:
  `visitor` - the visitor to notify, must not be null.

#### hashCode

    public int hashCode()

Description copied from interface: `Segment`
Generate a hash code from this`Segment`.

Hashcode typically derives from the `Segment.toString()` representation so two `Segment`s yield the same `Segment.hashCode()` if their `Segment.toString()` representation matches.

Specified by:
  `hashCode` in interface `Segment`
Overrides:
  `hashCode` in class `Object`
Returns:
  a hash code value for this object.

#### equals

    public boolean equals(Object obj)

Description copied from interface: `Segment`
Check whether this `Segment` is equal to another `Segment`.

Equality is typically given if the `Segment.toString()` representation matches.

Specified by:
  `equals` in interface `Segment`
Overrides:
  `equals` in class `Object`
Parameters:
  `obj` - the reference object with which to compare.
Returns:
  true if this object is the same as the `other` argument; false otherwise.