org.jSyncManager.API.Conduit.SatelliteForms

Class SFColumn

Known Direct Subclasses:
SFBinaryColumn, SFDateColumn, SFFloatColumn, SFIntColumn, SFLogicalColumn, SFLongColumn, SFStringColumn, SFTimeColumn

public abstract class SFColumn
extends java.lang.Object

This class represents a SatelliteForms column description. This is an abstract base class. Derived classes implement the specific SatelliteForms data types. Alse see SFColumnFactory which will takes the column desciptions as stored in the AppRecord of a table and produce a set of derived classes for that the table's column types. For the most part, you need only treat data columns as instances of this type. Everything is a string when you use this class.

Field Summary

protected int
colDec
protected String
colName
protected int
colPos
protected int
colSize
protected char
colType
protected DLPRecord
d
protected int
dbItemSize
protected String
futureValue

Constructor Summary

SFColumn(byte[] cdef, int pos)
Construct a SFColumnDef from an array slice.

Method Summary

int
getColSize()
Returns the declared size of the column (the AppBlock size).
abstract byte[]
getDBItem()
protected byte[]
getDataArray()
Returns the raw byte array of this column's data as stored in SatelliteForms' internal format.
protected int
getDataOffset()
Returns the offset of the data array for this data column in the current record.
protected int
getDataSize()
Returns the size of the raw column data (in bytes).
int
getDecimals()
String
getName()
Returns the name of the column as defined in SatelliteForms.
char
getType()
Returns the single character "type" of this column as used in SFColumnFactory.
abstract String
getValue()
Get this column's current data value as a string.
static void
main(String[] args)
void
setCurRec(DLPRecord rec)
void
setValue(String st)
Sets the "new" value for this column.
String
toString()

Field Details

colDec

protected int colDec

colName

protected String colName

colPos

protected int colPos

colSize

protected int colSize

colType

protected char colType

d

protected DLPRecord d

dbItemSize

protected int dbItemSize

futureValue

protected String futureValue

Constructor Details

SFColumn

public SFColumn(byte[] cdef,
                int pos)
Parameters:
cdef - The byte array of the field descriptor
pos - The position (relative to the start of data) of the field in the data record.

Method Details

getColSize

public int getColSize()
Returns the declared size of the column (the AppBlock size).

getDBItem

public abstract byte[] getDBItem()
            throws SFTableException

getDataArray

protected byte[] getDataArray()
            throws SFTableException
Returns the raw byte array of this column's data as stored in SatelliteForms' internal format. In general, you will not directly use this method. Use getValue instead, which returns a string parsed by the typed subclass.

getDataOffset

protected int getDataOffset()
            throws SFTableException
Returns the offset of the data array for this data column in the current record. In general, you will not use this method unless you need to manipulate raw SF data.
Returns:
Offset of this columns data as an int

getDataSize

protected int getDataSize()
            throws SFTableException
Returns the size of the raw column data (in bytes). In general, you will not use this method directly unless you need to handle raw SF data for some reason.

getDecimals

public int getDecimals()

getName

public String getName()
Returns the name of the column as defined in SatelliteForms. This value is used as the column's key in the SFTable.getColumns method.

getType

public char getType()

getValue

public abstract String getValue()
            throws SFTableException
Get this column's current data value as a string. This is an abstract method implemented by the type-specific subclass. Since this always returns a string, it makes a nice "typeless" interface. Be aware that the SFTableException may be thrown if the string value is incompatible with the underlying subclass. Note that the value returned by this method is ALWAYS the value parsed from the DLPRecord used to construct. In other words, setValue(String) doesn't change this value.

main

public static void main(String[] args)

setCurRec

public void setCurRec(DLPRecord rec)

setValue

public void setValue(String st)
            throws SFTableException
Sets the "new" value for this column. This is something to be aware of. For various reasons related to the application for which I developed this library, the value of column as parsed from a DLPRecord remains available, even after calling this method to set the value that will be returned by the SFTable.getDataRecord method. The value you set with this method is saved in an internal attribute called "futureValue." This value will appear when SFTable.getDataRecord is called, but the column hash will still have the "original" value in it. The value you set here will likewise NOT be returned by the SFColumn.getValue call. The original value will be returned. I leave it to users of the library whether to change this behavior and I suggest that if you do, you should have getValue return the value set by this method (if any) and the original value if none is set, and add a new method called "getOriginalValue" that works like the current "getValue" works.

toString

public String toString()