org.eclipse.datatools.connectivity.oda.spec.result
Class ColumnIdentifier

java.lang.Object
  extended by org.eclipse.datatools.connectivity.oda.spec.result.ColumnIdentifier

public class ColumnIdentifier
extends java.lang.Object

The identifier of a result set column, defined by its number and/or native name/expression.
A column number, if specified, takes precedence over its specified name/expression. A column number is 1-based, as defined in an IResultSet before any dynamic projection is applied.
A ColumnIdentifier instance may be used as an unique key in a Map. Comparison by name is case-sensitive.


Constructor Summary
ColumnIdentifier(int pos)
          Constructor that creates an instance that identifies a result set column by its ordinal position.
ColumnIdentifier(int pos, java.lang.String nameExpr)
          Constructor that creates an instance that identifies a result set column by both its ordinal position and native name/expression.
ColumnIdentifier(java.lang.String nameExpr)
          Constructor that creates an instance that identifies a result set column by its native name or expression.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getNameExpression()
          Gets the column's native name or expression, if specified.
 java.lang.Integer getNumber()
          Gets the column number, if specified.
 java.lang.String getValueExpression()
          Deprecated. getNameExpression()
 int hashCode()
           
 boolean hasNameExpression()
          Indicates whether this has a name expression specified.
 boolean hasValueExpression()
          Deprecated. replaced by hasNameExpression()
 boolean isIdentifiedByNumber()
          Indicates whether this has a valid number that is used as the identifier.
 boolean isValid()
          Indicates whether this has either a valid number or name expression.
 void setNameExpression(java.lang.String nameExpr)
          Sets the column's native name or expression.
 void setNumber(java.lang.Integer pos)
          Sets the column number.
 void setValueExpression(java.lang.String valueExpr)
          Deprecated. replaced by setNameExpression(String)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnIdentifier

public ColumnIdentifier(int pos,
                        java.lang.String nameExpr)
Constructor that creates an instance that identifies a result set column by both its ordinal position and native name/expression. This would uniquely identify a column when multiple columns in a result set have the same name.

Parameters:
pos - column number (1-based)
nameExpr - native name or expression of the column

ColumnIdentifier

public ColumnIdentifier(int pos)
Constructor that creates an instance that identifies a result set column by its ordinal position.

Parameters:
pos - column number (1-based)
Throws:
java.lang.IllegalArgumentException - if specified argument is not greater or equal to 1

ColumnIdentifier

public ColumnIdentifier(java.lang.String nameExpr)
Constructor that creates an instance that identifies a result set column by its native name or expression.

Parameters:
nameExpr - native name or expression of the column
Throws:
java.lang.IllegalArgumentException - if specified argument is null or empty
Method Detail

setNumber

public void setNumber(java.lang.Integer pos)
Sets the column number.

Parameters:
pos - column number; may be null

setNameExpression

public void setNameExpression(java.lang.String nameExpr)
Sets the column's native name or expression.

Parameters:
nameExpr - a column's native name or expression; may be null

setValueExpression

public void setValueExpression(java.lang.String valueExpr)
Deprecated. replaced by setNameExpression(String)

Sets the column's native name or expression.

Parameters:
valueExpr - a column's native name or expression; may be null

getNumber

public java.lang.Integer getNumber()
Gets the column number, if specified.

Returns:
column number, or null if not specified

getNameExpression

public java.lang.String getNameExpression()
Gets the column's native name or expression, if specified.

Returns:
column's native name or expression, or null if not specified

getValueExpression

public java.lang.String getValueExpression()
Deprecated. getNameExpression()

Gets the column's native name or expression, if specified.

Returns:
column's native name or expression, or null if not specified

isIdentifiedByNumber

public boolean isIdentifiedByNumber()
Indicates whether this has a valid number that is used as the identifier.

Returns:
true if this is identified by the column number; false otherwise

hasNameExpression

public boolean hasNameExpression()
Indicates whether this has a name expression specified. The name expression is superceded by the ordinal position identifier, if exists.

Returns:
true if this has a name expression; false otherwise

hasValueExpression

public boolean hasValueExpression()
Deprecated. replaced by hasNameExpression()

Indicates whether this has a name expression specified. The name expression, if exists, is ignored if this is identified by number.

Returns:
true if this has a name expression; false otherwise

isValid

public boolean isValid()
Indicates whether this has either a valid number or name expression.

Returns:
true if this has a valid number or name expression; false otherwise

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object