OSMQ
v2.0.1

osmq.records
Interface DataRecord

All Superinterfaces:
ByteArray, osmq.datarows.DataRow, Immutable
All Known Implementing Classes:
DataRecordBean, DataRecordWrapper

public interface DataRecord
extends osmq.datarows.DataRow, Immutable, ByteArray

A multi-element container that sets and returns its elements as either Strings or scalar data types. The DataRecord supports mapping data as an int, double, long, char, String, and Date. The elements are referenced positionally (1-n). (Note that the indexing scheme can be changed by calling the method setOffsetIndex(int).) The getElementCount() method returns the number of elements in the container. This interface is modeled after the getXXX and setXXX methods implemented by the JDBC ResultSet and Statement classes.


Field Summary
static char DEFAULT_DELIMITER
           
 
Method Summary
 void clear(int positionIndex)
          Clears the value at the designated position, setting it to null (or zero if numeric)
 void clearAll()
          Clears all the elements, setting them to null (or zero if numeric)
 java.lang.Object clone()
           
 java.lang.Object[] getAsArray()
          Returns an array that contains all element values
 java.math.BigDecimal getBigDecimal(int positionIndex)
          Returns the value at the designated position as a BigDecimal
 boolean getBoolean(int positionIndex)
          Returns the value at the designated position as a boolean
 byte getByte(int positionIndex)
          Returns the value at the designated position as a byte
 byte[] getBytes()
          Returns the elements as an array of bytes.
 char getChar(int positionIndex)
          Returns the value at the designated position as a char
 java.util.Date getDate(int positionIndex)
          Returns the value at the designated position as a Date
 char getDefaultDelimiter()
          Returns the character that is used to delimit the various elements when the elements are strung together.
 double getDouble(int positionIndex)
          Returns the value at the designated position as a double
 int getElementCount()
          Returns the number of element positions (including those that are empty)
 float getFloat(int positionIndex)
          Returns the value at the designated position as a float
 java.lang.String getFormattedDateString(int posn)
          Returns the value at the designated position as a formatted date string in CCYY-MM-DD format.
 int getInt(int positionIndex)
          Returns the value at the designated position as an integer
 long getLong(int positionIndex)
          Returns the value at the designated position as a long integer
 java.lang.Object getObject(int positionIndex)
          Returns the value of the designated position.
 int getOffsetIndex()
          Returns the base index currently used to reference elements.
 short getShort(int positionIndex)
          Returns the value at the designated position as a short integer
 java.sql.Date getSQLDate(int posn)
          Returns the value at the designated position as a java.SQL.Date
 java.lang.String getString(int positionIndex)
          Returns the value of the designated position as a String
 java.lang.String getText()
          Creates a delimited String from the elements The first character in the String is assumed to be the delimiting character.
 java.lang.String getUnformattedDateString(int posn)
          Returns the value at the designated position as an unformatted date string in CCYYMMDD format.
 java.lang.String getUpperCaseString(int positionIndex)
          Returns the value at the designated position as a String with all characters forced into upper case.
 boolean hasAValue(int n)
          Determines whether a position has a value (versus null)
 boolean isEmpty(int n)
          Determines if a position has no value (is empty).
 boolean isNull(int n)
          Determines if a position has no value (is empty).
 void resetSize(int size)
          Resets the size (number of elements), and clears all the values
 void setBigDecimal(int positionIndex, java.math.BigDecimal value)
          Sets the element at the designated position to a BigDecimal value
 void setBoolean(int positionIndex, boolean value)
          Sets the element at the designated position to a boolean value
 void setByte(int positionIndex, byte value)
          Sets the element at the designated position to a byte value
 void setBytes(byte[] value)
          Sets the elements to the values found in a delimited array of bytes.
 void setChar(int positionIndex, char value)
          Sets the element at the designated position to a char value
 void setDate(int positionIndex, java.util.Date value)
          Sets the element at the designated position to a Date value
 void setDateString(int posn, java.lang.String value)
           
 void setDecimalString(int posn, java.lang.String value)
          Sets the element at the designated position to a String value that represents a decimal value.
 void setDouble(int positionIndex, double value)
          Sets the element at the designated position to a double value
 void setFloat(int positionIndex, float value)
          Sets the element at the designated position to a float value
 void setFromArray(java.lang.Object[] v)
          Sets the data elements from the values in an array.
 void setInt(int positionIndex, int value)
          Sets the element at the designated position to an int value
 void setLong(int positionIndex, long value)
          Sets the element at the designated position to a long value
 void setNull(int positionIndex)
          Sets the value at the designated position to null
 void setObject(int positionIndex, java.lang.Object value)
          Sets the value at the designated position
 void setOffsetIndex(int value)
          Sets the base index used to reference elements.
 void setShort(int positionIndex, short value)
          Sets the element at the designated position to a short value
 void setString(int positionIndex, java.lang.String value)
          Sets the element at the designated position to a String value
 void setText(java.lang.String value)
          Sets the elements to the values found in a delimited String.
 void setTrimmedString(int positionIndex, java.lang.String value)
          Sets the element at the designated position to a String value.
 void setUpperCaseString(int positionIndex, java.lang.String value)
          Sets the element at the designated position to an upper-case String value
 boolean wasNull()
          Returns true if the last fetched element was a null object, or the last fetched has a string length of zero.
 
Methods inherited from interface osmq.util.Immutable
isImmutable, setImmutable
 
Methods inherited from interface osmq.util.ByteArray
hasADelimiter, isADataRecord
 

Field Detail

DEFAULT_DELIMITER

public static final char DEFAULT_DELIMITER
See Also:
Constant Field Values
Method Detail

hasAValue

public boolean hasAValue(int n)
Determines whether a position has a value (versus null)

Specified by:
hasAValue in interface osmq.datarows.DataRow
Returns:
true of there is a non-null value at position p, else false
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

isEmpty

public boolean isEmpty(int n)
Determines if a position has no value (is empty). Alias method for isNull(int)

Specified by:
isEmpty in interface osmq.datarows.DataRow
Returns:
true if there is a null value (no value) at position p, else false
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

isNull

public boolean isNull(int n)
Determines if a position has no value (is empty). Alias method for isEmpty(int)

Specified by:
isNull in interface osmq.datarows.DataRow
Returns:
true if there is a null value (no value) at position p, else false
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getObject

public java.lang.Object getObject(int positionIndex)
Returns the value of the designated position.

Specified by:
getObject in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the value as an Object or null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getString

public java.lang.String getString(int positionIndex)
Returns the value of the designated position as a String

Specified by:
getString in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a String or a null String if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getUpperCaseString

public java.lang.String getUpperCaseString(int positionIndex)
Returns the value at the designated position as a String with all characters forced into upper case.

Specified by:
getUpperCaseString in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the value as a String or a null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid element position.

getBoolean

public boolean getBoolean(int positionIndex)
Returns the value at the designated position as a boolean

Specified by:
getBoolean in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the value as a boolean or a null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getChar

public char getChar(int positionIndex)
Returns the value at the designated position as a char

Specified by:
getChar in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the value as a char or 0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getByte

public byte getByte(int positionIndex)
Returns the value at the designated position as a byte

Specified by:
getByte in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the value as a byte or 0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getInt

public int getInt(int positionIndex)
Returns the value at the designated position as an integer

Specified by:
getInt in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the value as an int or a 0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getShort

public short getShort(int positionIndex)
Returns the value at the designated position as a short integer

Specified by:
getShort in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a short or 0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if columnIndex is not a valid element position.

getLong

public long getLong(int positionIndex)
Returns the value at the designated position as a long integer

Specified by:
getLong in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a long or 0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getDouble

public double getDouble(int positionIndex)
Returns the value at the designated position as a double

Specified by:
getDouble in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a double or 0.0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getFloat

public float getFloat(int positionIndex)
Returns the value at the designated position as a float

Specified by:
getFloat in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a double or 0.0 if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getBigDecimal

public java.math.BigDecimal getBigDecimal(int positionIndex)
Returns the value at the designated position as a BigDecimal

Specified by:
getBigDecimal in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a BigDecimal or null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getDate

public java.util.Date getDate(int positionIndex)
Returns the value at the designated position as a Date

Specified by:
getDate in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Returns:
the position value as a Date or null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getFormattedDateString

public java.lang.String getFormattedDateString(int posn)
Returns the value at the designated position as a formatted date string in CCYY-MM-DD format.

Specified by:
getFormattedDateString in interface osmq.datarows.DataRow
Returns:
the position value as a String or null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

getUnformattedDateString

public java.lang.String getUnformattedDateString(int posn)
Returns the value at the designated position as an unformatted date string in CCYYMMDD format. (This is the normal physical storage format for a date).

Specified by:
getUnformattedDateString in interface osmq.datarows.DataRow
Returns:
the position value as a String or null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
See Also:
setDateString(int, String)

getSQLDate

public java.sql.Date getSQLDate(int posn)
Returns the value at the designated position as a java.SQL.Date

Specified by:
getSQLDate in interface osmq.datarows.DataRow
Returns:
the position value as an sql Date or null if the position is empty.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
See Also:
setDateString(int, String)

getOffsetIndex

public int getOffsetIndex()
Returns the base index currently used to reference elements.

Specified by:
getOffsetIndex in interface osmq.datarows.DataRow

getElementCount

public int getElementCount()
Returns the number of element positions (including those that are empty)

Specified by:
getElementCount in interface osmq.datarows.DataRow
Returns:
the number of DataRecord elements
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.

clear

public void clear(int positionIndex)
Clears the value at the designated position, setting it to null (or zero if numeric)

Specified by:
clear in interface osmq.datarows.DataRow
Throws:
ImmutableDataException - if the DataRecord object is immutable.

setObject

public void setObject(int positionIndex,
                      java.lang.Object value)
               throws ImmutableException
Sets the value at the designated position

Specified by:
setObject in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if p is not a valid element position.
ImmutableException - if the DataRecord object is immutable.

setNull

public void setNull(int positionIndex)
             throws ImmutableException
Sets the value at the designated position to null

Specified by:
setNull in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
Throws:
java.lang.ArrayIndexOutOfBoundsException - if p is not a valid element position.
ImmutableException - if the DataRecord object is immutable.

setString

public void setString(int positionIndex,
                      java.lang.String value)
               throws ImmutableException
Sets the element at the designated position to a String value

Specified by:
setString in interface osmq.datarows.DataRow
Parameters:
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if p is not a valid element position.
ImmutableException - if the DataRecord object is immutable.

setTrimmedString

public void setTrimmedString(int positionIndex,
                             java.lang.String value)
                      throws ImmutableException
Sets the element at the designated position to a String value. Setting the value also eliminates any leading or trailing spaces.

Specified by:
setTrimmedString in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setDecimalString

public void setDecimalString(int posn,
                             java.lang.String value)
                      throws ImmutableException
Sets the element at the designated position to a String value that represents a decimal value. Setting the element ensures that the string has a decimal component, and excessive non-significant decimal values (trailing zeros) are dropped. A value of "5" will result in a string value of "5.0" and a value of "5.400" will result in a string value of "5.4".

Specified by:
setDecimalString in interface osmq.datarows.DataRow
Parameters:
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setBoolean

public void setBoolean(int positionIndex,
                       boolean value)
                throws ImmutableException
Sets the element at the designated position to a boolean value

Specified by:
setBoolean in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setUpperCaseString

public void setUpperCaseString(int positionIndex,
                               java.lang.String value)
                        throws ImmutableException
Sets the element at the designated position to an upper-case String value

Specified by:
setUpperCaseString in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setInt

public void setInt(int positionIndex,
                   int value)
            throws ImmutableException
Sets the element at the designated position to an int value

Specified by:
setInt in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setChar

public void setChar(int positionIndex,
                    char value)
             throws ImmutableException
Sets the element at the designated position to a char value

Specified by:
setChar in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setByte

public void setByte(int positionIndex,
                    byte value)
             throws ImmutableException
Sets the element at the designated position to a byte value

Specified by:
setByte in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setShort

public void setShort(int positionIndex,
                     short value)
              throws ImmutableException
Sets the element at the designated position to a short value

Specified by:
setShort in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setLong

public void setLong(int positionIndex,
                    long value)
             throws ImmutableException
Sets the element at the designated position to a long value

Specified by:
setLong in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setDouble

public void setDouble(int positionIndex,
                      double value)
               throws ImmutableException
Sets the element at the designated position to a double value

Specified by:
setDouble in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setFloat

public void setFloat(int positionIndex,
                     float value)
              throws ImmutableException
Sets the element at the designated position to a float value

Specified by:
setFloat in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setDate

public void setDate(int positionIndex,
                    java.util.Date value)
             throws ImmutableException
Sets the element at the designated position to a Date value

Specified by:
setDate in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setDateString

public void setDateString(int posn,
                          java.lang.String value)
                   throws ImmutableException
Specified by:
setDateString in interface osmq.datarows.DataRow
Throws:
ImmutableException

setBigDecimal

public void setBigDecimal(int positionIndex,
                          java.math.BigDecimal value)
                   throws ImmutableException
Sets the element at the designated position to a BigDecimal value

Specified by:
setBigDecimal in interface osmq.datarows.DataRow
Parameters:
positionIndex - the first position is 1, the second is 2, ...
value - the element's new value
Throws:
java.lang.ArrayIndexOutOfBoundsException - if positionIndex is not a valid position.
ImmutableException - if the DataRecord object is immutable.

setOffsetIndex

public void setOffsetIndex(int value)
Sets the base index used to reference elements. If not set explicitly, this index defaults to 1.

Specified by:
setOffsetIndex in interface osmq.datarows.DataRow
Parameters:
value - the new base index value

getDefaultDelimiter

public char getDefaultDelimiter()
Returns the character that is used to delimit the various elements when the elements are strung together. The string of elements is accessible by calling the getText() method.


getBytes

public byte[] getBytes()
Returns the elements as an array of bytes. The first byte in the array is the element delimiter.

Specified by:
getBytes in interface ByteArray

getText

public java.lang.String getText()
Creates a delimited String from the elements The first character in the String is assumed to be the delimiting character.


setText

public void setText(java.lang.String value)
Sets the elements to the values found in a delimited String. The first character in the String is assumed to be the delimiting character.

Throws:
ImmutableDataException - if the DataRecord object is immutable.

setBytes

public void setBytes(byte[] value)
Sets the elements to the values found in a delimited array of bytes. The first byte in the array is assumed to be the delimiting character.

Specified by:
setBytes in interface ByteArray
Throws:
ImmutableDataException - if the DataRecord object is immutable.

getAsArray

public java.lang.Object[] getAsArray()
Returns an array that contains all element values


resetSize

public void resetSize(int size)
               throws ImmutableException
Resets the size (number of elements), and clears all the values

Parameters:
size - the number of elements in the resized object
Throws:
ImmutableDataException - if the DataRecord object is immutable
ImmutableException

clearAll

public void clearAll()
              throws ImmutableException
Clears all the elements, setting them to null (or zero if numeric)

Throws:
ImmutableDataException - if the DataRecord object is immutable.
ImmutableException

setFromArray

public void setFromArray(java.lang.Object[] v)
                  throws ImmutableException
Sets the data elements from the values in an array.

Throws:
ImmutableException - if the data elements are immutable.

wasNull

public boolean wasNull()
Returns true if the last fetched element was a null object, or the last fetched has a string length of zero. (The last fetched is the element referenced by the last getXXX() method call.)


clone

public java.lang.Object clone()

(c) 2000 - 2003 MQue Systems
All Rights Reserved