Package edu.caltech.nanodb.relations
Class ColumnInfo
- java.lang.Object
-
- edu.caltech.nanodb.relations.ColumnInfo
-
- All Implemented Interfaces:
java.io.Serializable
public class ColumnInfo extends java.lang.Object implements java.io.Serializable
Basic information about a table column, including its name and SQL type. Constraints, even "NOT NULL" constraints, appear at the table level, since some constraints can involve multiple columns.- See Also:
- Serialized Form
- Design Note:
- (donnie) Right now this class is immutable, which I tend to think is
a good idea for schema information. So far there aren't any classes
that really require the ability to mutate column-info objects,
although the biggest candidates are the
TupleLiteral
class and theProjectNode
class, which sometimes need to generate names for their results.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
name
The name of the attribute.private java.lang.String
tableName
An optional table-name for the attribute, in cases where a join or Cartesian product generates a result with duplicate attribute-names.private ColumnType
type
The type information for the column.
-
Constructor Summary
Constructors Constructor Description ColumnInfo(ColumnType type)
Construct a new column-info object for a column, specifying the type of the column.ColumnInfo(java.lang.String name, ColumnType type)
Construct a new column-info object for a column, specifying the attribute name and type of the column.ColumnInfo(java.lang.String name, java.lang.String tableName, ColumnType type)
Construct a new column-info object for a column, specifying the attribute name, table name, and type of the column.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
ColumnName
getColumnName()
Returns aColumnName
object representing the name of this column.java.lang.String
getName()
Returns the name of the attribute.java.lang.String
getTableName()
Returns the table-name of the attribute.ColumnType
getType()
Returns the type of the attribute.int
hashCode()
java.lang.String
toString()
Returns a string representation of the column-info.
-
-
-
Field Detail
-
name
private java.lang.String name
The name of the attribute.
-
tableName
private java.lang.String tableName
An optional table-name for the attribute, in cases where a join or Cartesian product generates a result with duplicate attribute-names. In most cases it is expected that this table-name will be null.
-
type
private ColumnType type
The type information for the column.
-
-
Constructor Detail
-
ColumnInfo
public ColumnInfo(java.lang.String name, java.lang.String tableName, ColumnType type)
Construct a new column-info object for a column, specifying the attribute name, table name, and type of the column.- Parameters:
name
- the attribute name, ornull
if unspecifiedtableName
- the table name, ornull
if unspecifiedtype
- the type of the column
-
ColumnInfo
public ColumnInfo(java.lang.String name, ColumnType type)
Construct a new column-info object for a column, specifying the attribute name and type of the column. The table name is unspecified.- Parameters:
name
- the attribute name, ornull
if unspecifiedtype
- the type of the column
-
ColumnInfo
public ColumnInfo(ColumnType type)
Construct a new column-info object for a column, specifying the type of the column. The attribute name and table name are unspecified.- Parameters:
type
- the type of the column
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the attribute.- Returns:
- the name of the attribute
-
getTableName
public java.lang.String getTableName()
Returns the table-name of the attribute.- Returns:
- the table-name of the attribute
-
getColumnName
public ColumnName getColumnName()
Returns aColumnName
object representing the name of this column.- Returns:
- a column-name object for this column
-
getType
public ColumnType getType()
Returns the type of the attribute.- Returns:
- the type of the attribute
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the column-info.- Overrides:
toString
in classjava.lang.Object
-
-