/*
 * Created on Feb 7, 2004
 *
 */
package LumiSoft.Data;

/**
 * 
 */
public class DataColumn 
{	
	private DataTable m_pTable       = null;
	private String    m_ColumnName   = "";
	private int       m_Index        = 0;
	private Class     m_DataType     = null;
	private Object    m_DefaultValue = null;
	
	protected DataColumn(DataTable table,String columnName,int index,Class dataType)
	{
		m_pTable     = table;
		m_ColumnName = columnName;
		m_Index      = index;
		m_DataType   = dataType;
	}
	
	/**
	 * Gets the name of the column.
	 * @return
	 */
	public String getColumnName()
	{
		return m_ColumnName;
	}
	
	/**
	 * Gets or sets the type of data stored in the column.
	 * @return
	 */
	public Class getDataType()
	{
		return m_DataType;
	}
	
	/**
	 * Gets the default value for the column when creating new rows.
	 * @return
	 */
	public Object getDefaultValue()
	{
		return m_DefaultValue;
	}
	/**
	 * Sets the default value for the column when creating new rows.
	 * @param value
	 */
	public void setDefaultValue(Object value)
	{
		if(m_DefaultValue != value){
			m_DefaultValue = value;
		}
	}
	
	/**
	 * Gets the DataTable to which the column belongs to.
	 * @return
	 */
	public DataTable getTable()
	{
		return m_pTable;
	}
	
	protected int getIndex()
	{
		return m_Index;
	}
}
