Class DataListEntry

java.lang.Object
org.apache.empire.data.list.DataListEntry
All Implemented Interfaces:
Serializable, RecordData

public class DataListEntry extends Object implements RecordData, Serializable
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final DataListHead
     
    protected int
     
    protected final Object[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    DataListEntry(DataListHead head, Object[] values, int rownum)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    compareKey(Column[] keyColumns, Object[] key)
    Compares a given record key with the key of the entry
    get(ColumnExpr column)
    Returns a data value for the desired column .
    final <V> V
    get(ColumnExpr column, Class<V> valueType)
    returns the record value for a particular column
    final Object[]
    getArray(ColumnExpr... columns)
    Returns an array of values for the given column expressions
    final boolean
    getBoolean(int index)
    Returns a data value identified by the column index.
    final boolean
    Returns a data value for the desired column.
    getColumn(int index)
    returns the column expression for a given column This is the reverse operation of getFieldIndex()
    final Date
    getDate(int index)
    Returns the value as as a java.util.Date object The data value is converted to a Date if necessary.
    final Date
    Returns the value as as a java.util.Date object The data value is converted to a Date if necessary.
    getDecimal(int index)
    Returns a data value identified by the column index.
    Returns a data value for the desired column.
    double
    getDouble(int index)
    Returns a data value identified by the column index.
    final double
    Returns a data value for the desired column.
    final <T extends Enum<?>>
    T
    getEnum(int index, Class<T> enumType)
    Returns the value of a field as an enum For numeric columns the value is assumed to be an ordinal of the enumeration item For non numeric columns the value is assumed to be the name of the enumeration item
    final <T extends Enum<?>>
    T
    getEnum(Column column)
    Returns the value of a field as an enum This assumes that the column attribute "enumType" has been set to an enum type For numeric columns the value is assumed to be an ordinal of the enumeration item
    final <T extends Enum<?>>
    T
    getEnum(ColumnExpr column, Class<T> enumType)
    Returns the value of a field as an enum For numeric columns the value is assumed to be an ordinal of the enumeration item For non numeric columns the value is assumed to be the name of the enumeration item
    int
    returns the number of field available
    int
    returns the index of the column expression with the given name
    int
    returns the index of the given column expression Indexed operations provide better performance for bulk processing
    <T extends DataListHead>
    T
     
    final int
    getInt(int index)
    Returns a data value identified by the column index.
    final int
    Returns a data value for the desired column.
    final LocalDate
    getLocalDate(int index)
    Returns a data value identified by the column index.
    final LocalDate
    Returns a data value for the desired column.
    getLocalDateTime(int index)
    Returns a data value identified by the column index.
    Returns a data value for the desired column.
    final long
    getLong(int index)
    Returns a data value identified by the column index.
    final long
    Returns a data value for the desired column.
    long
    Returns the record id for a type of entity which has a single numeric primary key
    Returns the record key for a type of entity
    int
    Returns the row-number This works only, if the row number has been set in the constructor
    final String
    getString(int index)
    Returns a data value identified by the column index.
    final String
    Returns a data value for the desired column.
    getText(String columnName)
    Returns the value of a column as a formatted text This converts the value to a string if necessary and performs an options lookup To customize conversion please override convertToString()
    Returns the value of a column as a formatted text This converts the value to a string if necessary and performs an options lookup To customize conversion please override convertToString()
    final Timestamp
    getTimestamp(int index)
    Returns the value as as a java.sql.Timestamp object
    final Timestamp
    Returns the value as as a java.sql.Timestamp object
    getValue(int index)
    Returns the raw field value based on the field index.
    <V> V
    getValue(int index, Class<V> valueType)
    returns the record value for a particular column
    boolean
     
    boolean
    isNull(int index)
    Checks whether or not the value for the given column is null.
    final boolean
    Checks whether or not the value for the given column is null.
    boolean
    Returns true if a numeric value is Zero For numeric columns only!
    void
    Modifies a particular value
    final int
    Injects the current field values into a java bean.
    int
    setBeanProperties(Object bean, Collection<? extends ColumnExpr> ignoreList)
    Injects the current field values into a java bean.
    protected void
    setBeanProperty(ColumnExpr column, Object bean, Object value)
    Set a single property value on a java bean object
     
    void
    Updates the fields of the entry with the corresponding fields of a record.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • values

      protected final Object[] values
    • rownum

      protected int rownum
  • Constructor Details

  • Method Details

    • getHead

      public <T extends DataListHead> T getHead()
    • getRecordKey

      public Object[] getRecordKey(Entity entity)
      Returns the record key for a type of entity
      Parameters:
      entity - the entity type or rowset for which to get key
      Returns:
      the record key
    • getRecordId

      public long getRecordId(Entity entity)
      Returns the record id for a type of entity which has a single numeric primary key
      Parameters:
      entity - the entity type or rowset for which to get key
      Returns:
      the record id
      Throws:
      InvalidArgumentException - if the entity has not a single numeric primary key
    • compareKey

      public boolean compareKey(Column[] keyColumns, Object[] key)
      Compares a given record key with the key of the entry
      Parameters:
      keyColumns - the columns which make up the key
      key - the key to compare the current entry to
      Returns:
      true if the keys match or false otherwise
    • updateData

      public void updateData(RecordData recData)
      Updates the fields of the entry with the corresponding fields of a record.
      Parameters:
      recData - the record with the updated (newer) fields
    • modifyValue

      public void modifyValue(ColumnExpr col, Object value)
      Modifies a particular value
      Parameters:
      col - the column to modify
      value - the new value
    • getRownum

      public int getRownum()
      Returns the row-number This works only, if the row number has been set in the constructor
      Returns:
      the row number
    • getFieldCount

      public int getFieldCount()
      Description copied from interface: RecordData
      returns the number of field available
      Specified by:
      getFieldCount in interface RecordData
      Returns:
      field count
    • hasField

      public boolean hasField(ColumnExpr column)
    • getFieldIndex

      public int getFieldIndex(ColumnExpr column)
      Description copied from interface: RecordData
      returns the index of the given column expression Indexed operations provide better performance for bulk processing
      Specified by:
      getFieldIndex in interface RecordData
      Parameters:
      column - the column for which to return the index
      Returns:
      the field index of the given column
    • getFieldIndex

      public int getFieldIndex(String column)
      Description copied from interface: RecordData
      returns the index of the column expression with the given name
      Specified by:
      getFieldIndex in interface RecordData
      Parameters:
      column - the name of the column for which to return the index
      Returns:
      the field index of the given column
    • getColumn

      public ColumnExpr getColumn(int index)
      Description copied from interface: RecordData
      returns the column expression for a given column This is the reverse operation of getFieldIndex()
      Specified by:
      getColumn in interface RecordData
      Parameters:
      index - field index of the column expression
      Returns:
      the column expression object or null if the index is out of range
    • getValue

      public Object getValue(int index)
      Returns the raw field value based on the field index.
      Specified by:
      getValue in interface RecordData
      Parameters:
      index - the field index
      Returns:
      the raw field value
    • getValue

      public <V> V getValue(int index, Class<V> valueType)
      returns the record value for a particular column
      Specified by:
      getValue in interface RecordData
      Type Parameters:
      V - the desired return type for the value
      Parameters:
      index - the field index for which to return the value
      valueType - the desired value type
      Returns:
      the record value for the given column
    • get

      public final <V> V get(ColumnExpr column, Class<V> valueType)
      returns the record value for a particular column
      Specified by:
      get in interface RecordData
      Parameters:
      column - the column for which to return the value
      valueType - the desired value type
      Returns:
      the record value for the given column
    • get

      public Object get(ColumnExpr column)
      Returns a data value for the desired column .
      Specified by:
      get in interface RecordData
      Parameters:
      column - the column for which to obtain the value
      Returns:
      the record value
    • isNull

      public boolean isNull(int index)
      Checks whether or not the value for the given column is null.
      Specified by:
      isNull in interface RecordData
      Parameters:
      index - index of the column
      Returns:
      true if the value is null or false otherwise
    • isNull

      public final boolean isNull(ColumnExpr column)
      Checks whether or not the value for the given column is null.
      Specified by:
      isNull in interface RecordData
      Parameters:
      column - identifying the column
      Returns:
      true if the value is null or false otherwise
    • isZero

      public boolean isZero(ColumnExpr column)
      Returns true if a numeric value is Zero For numeric columns only!
      Parameters:
      column - the column
      Returns:
      true if the value is zero or false otherwise
    • getString

      public final String getString(int index)
      Returns a data value identified by the column index. The data value is converted to a string if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getString

      public final String getString(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to a string if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getInt

      public final int getInt(int index)
      Returns a data value identified by the column index. The value is converted to integer if necessary .
      Parameters:
      index - index of the column
      Returns:
      the record value
    • getInt

      public final int getInt(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to integer if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getLong

      public final long getLong(int index)
      Returns a data value identified by the column index. The data value is converted to a long if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getLong

      public final long getLong(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to a long if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getDouble

      public double getDouble(int index)
      Returns a data value identified by the column index. The data value is converted to double if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getDouble

      public final double getDouble(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to double if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getDecimal

      public final BigDecimal getDecimal(int index)
      Returns a data value identified by the column index. The data value is converted to double if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getDecimal

      public final BigDecimal getDecimal(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to BigDecimal if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getBoolean

      public final boolean getBoolean(int index)
      Returns a data value identified by the column index. The data value is converted to boolean if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getBoolean

      public final boolean getBoolean(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to boolean if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getDate

      public final Date getDate(int index)
      Returns the value as as a java.util.Date object The data value is converted to a Date if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getDate

      public final Date getDate(ColumnExpr column)
      Returns the value as as a java.util.Date object The data value is converted to a Date if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getTimestamp

      public final Timestamp getTimestamp(int index)
      Returns the value as as a java.sql.Timestamp object
      Parameters:
      index - the column index
      Returns:
      the timestamp value
    • getTimestamp

      public final Timestamp getTimestamp(ColumnExpr column)
      Returns the value as as a java.sql.Timestamp object
      Parameters:
      column - the timestamp column
      Returns:
      the timestamp value
    • getLocalDate

      public final LocalDate getLocalDate(int index)
      Returns a data value identified by the column index. The data value is converted to a Date if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getLocalDate

      public final LocalDate getLocalDate(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to a Date if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getLocalDateTime

      public final LocalDateTime getLocalDateTime(int index)
      Returns a data value identified by the column index. The data value is converted to a Date if necessary.
      Parameters:
      index - index of the column
      Returns:
      the value
    • getLocalDateTime

      public final LocalDateTime getLocalDateTime(ColumnExpr column)
      Returns a data value for the desired column. The data value is converted to a Date if necessary.
      Parameters:
      column - identifying the column
      Returns:
      the value
    • getEnum

      public final <T extends Enum<?>> T getEnum(int index, Class<T> enumType)
      Returns the value of a field as an enum For numeric columns the value is assumed to be an ordinal of the enumeration item For non numeric columns the value is assumed to be the name of the enumeration item
      Type Parameters:
      T - the enum type
      Parameters:
      index - index of the field
      enumType - the enum type class
      Returns:
      the enum value
    • getEnum

      public final <T extends Enum<?>> T getEnum(ColumnExpr column, Class<T> enumType)
      Returns the value of a field as an enum For numeric columns the value is assumed to be an ordinal of the enumeration item For non numeric columns the value is assumed to be the name of the enumeration item
      Type Parameters:
      T - the enum type
      Parameters:
      column - the column for which to retrieve the value
      enumType - the enum type class
      Returns:
      the enum value
    • getEnum

      public final <T extends Enum<?>> T getEnum(Column column)
      Returns the value of a field as an enum This assumes that the column attribute "enumType" has been set to an enum type For numeric columns the value is assumed to be an ordinal of the enumeration item
      Type Parameters:
      T - the enum type
      Parameters:
      column - the column for which to retrieve the value
      Returns:
      the enum value
    • getArray

      public final Object[] getArray(ColumnExpr... columns)
      Returns an array of values for the given column expressions
      Parameters:
      columns - the column expressions
      Returns:
      the corresponding record values
    • getText

      public String getText(ColumnExpr column)
      Returns the value of a column as a formatted text This converts the value to a string if necessary and performs an options lookup To customize conversion please override convertToString()
      Parameters:
      column - the column for which to get the formatted value
      Returns:
      the formatted value
    • getText

      public String getText(String columnName)
      Returns the value of a column as a formatted text This converts the value to a string if necessary and performs an options lookup To customize conversion please override convertToString()
      Parameters:
      columnName - the column for which to get the formatted value
      Returns:
      the formatted value
    • setBeanProperties

      public int setBeanProperties(Object bean, Collection<? extends ColumnExpr> ignoreList)
      Injects the current field values into a java bean. The property name is detected by ColumnExpr.getBeanPropertyName()
      Specified by:
      setBeanProperties in interface RecordData
      Parameters:
      bean - the Java Bean for which to set the properties
      ignoreList - list of columns to skip (optional)
      Returns:
      the number of bean properties set on the supplied bean
    • setBeanProperties

      public final int setBeanProperties(Object bean)
      Injects the current field values into a java bean. The property name is detected by ColumnExpr.getBeanPropertyName()
      Parameters:
      bean - the Java Bean for which to set the properties
      Returns:
      the number of bean properties set on the supplied bean
    • setBeanProperty

      protected void setBeanProperty(ColumnExpr column, Object bean, Object value)
      Set a single property value on a java bean object
      Parameters:
      column - the column expression
      bean - the bean
      value - the value
    • toString

      public String toString()
      Overrides:
      toString in class Object