ru.onego.industrial.catalog.meta
Class CatalogLineImpl

java.lang.Object
  extended by ru.onego.industrial.catalog.meta.CatalogLineImpl
All Implemented Interfaces:
java.lang.Comparable, CatalogLine

public class CatalogLineImpl
extends java.lang.Object
implements CatalogLine

Default implementation for the CatalogLine interface.

Version:
1.0
Author:
Lev Levin

Constructor Summary
CatalogLineImpl(java.util.List<java.lang.String> columns)
          Constructor for the object.
 
Method Summary
 int columnsCount()
          Returns count of columns represented by this line.
 int compareTo(java.lang.Object o)
          Implementation of the Comparable interface method.
 ColumnValue getColumnValue(int column)
          Returns column value by index of the column
 ColumnValue getColumnValue(java.lang.String column)
          Returns column value stored for column name.
 void setColumnValue(java.lang.String column, java.lang.Object value)
          Sets the column value.
 void setColumnValue(java.lang.String column, java.lang.Object value, boolean notEmpty)
          Sets the column value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogLineImpl

public CatalogLineImpl(java.util.List<java.lang.String> columns)
                throws MetaException
Constructor for the object. Builds new line and sets default values for columns.

Parameters:
columns - List of columns
Throws:
MetaException
Method Detail

setColumnValue

public void setColumnValue(java.lang.String column,
                           java.lang.Object value)
                    throws MetaException
Description copied from interface: CatalogLine
Sets the column value. Value is always replaced.

Specified by:
setColumnValue in interface CatalogLine
Parameters:
column - Column name
value - Value to be set for this column
Throws:
MetaException - Thrown if column is not found or type of the value is wrong.

setColumnValue

public void setColumnValue(java.lang.String column,
                           java.lang.Object value,
                           boolean notEmpty)
                    throws MetaException
Description copied from interface: CatalogLine
Sets the column value. Value is replaced only if last parameter is set to false.

Specified by:
setColumnValue in interface CatalogLine
Parameters:
column - Column name
value - Value to be set for this column
notEmpty - Specifies if value should be replaced
Throws:
MetaException - Thrown if column is not found or type of the value is wrong.

columnsCount

public int columnsCount()
Description copied from interface: CatalogLine
Returns count of columns represented by this line.

Specified by:
columnsCount in interface CatalogLine
Returns:
Number of columns

getColumnValue

public ColumnValue getColumnValue(java.lang.String column)
                           throws MetaException
Description copied from interface: CatalogLine
Returns column value stored for column name.

Specified by:
getColumnValue in interface CatalogLine
Parameters:
column - Column name
Returns:
ColumnValue object
Throws:
MetaException - Thrown if column not found

getColumnValue

public ColumnValue getColumnValue(int column)
                           throws MetaException
Description copied from interface: CatalogLine
Returns column value by index of the column

Specified by:
getColumnValue in interface CatalogLine
Parameters:
column - Column value
Returns:
ColumnValue object
Throws:
MetaException - Thrown if index is out of bounds

compareTo

public int compareTo(java.lang.Object o)
Implementation of the Comparable interface method.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Object to compare to
Returns:
negative, 0 or positive values