jMobileCore toolkit

com.jmobilecore.dstore
Class RecordStructure

java.lang.Object
  extended by com.jmobilecore.dstore.RecordStructure

public class RecordStructure
extends java.lang.Object

A RecordStructure represents a description of a database record

Author:
Greg Gridin

Field Summary
 int descLength
          Total length of all descriptor fields
 java.util.Vector fieldStructure
          A Vector of field structures in the current RecordStructure
 
Constructor Summary
RecordStructure(byte[] binaryForm)
          Creates new RecordStructure from binary form
RecordStructure(int fieldsNum)
          Creates new RecordStructure of specified size
 
Method Summary
 boolean addField(FieldStructure fStruct)
          Add new record field to the RecordStructure
 boolean addField(java.lang.String fName, int fType)
          Add new record field to the RecordStructure
 int getFieldNum(java.lang.String fName)
          Get field number for specified field name
 FieldStructure getFieldStructure(int fIndex)
          Get field structure for specified field number
 FieldStructure getFieldStructure(java.lang.String fName)
          Get field structure for specified field name
 byte[] toByteArray()
          Export current RecordStructure to binary form
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

descLength

public int descLength
Total length of all descriptor fields


fieldStructure

public java.util.Vector fieldStructure
A Vector of field structures in the current RecordStructure

Constructor Detail

RecordStructure

public RecordStructure(byte[] binaryForm)
Creates new RecordStructure from binary form

Parameters:
binaryForm - binary representation of RecordStructure
See Also:
toByteArray()

RecordStructure

public RecordStructure(int fieldsNum)
Creates new RecordStructure of specified size

Parameters:
fieldsNum - number of fields in the record.
Method Detail

addField

public boolean addField(FieldStructure fStruct)
Add new record field to the RecordStructure

Parameters:
fStruct - the field structure.
Returns:
true if field was successfully added to the record, false otherwise

addField

public boolean addField(java.lang.String fName,
                        int fType)
Add new record field to the RecordStructure

Parameters:
fName - the field name.
fType - the field type.
Returns:
true if field was successfully added to the record, false otherwise

getFieldNum

public int getFieldNum(java.lang.String fName)
Get field number for specified field name

Parameters:
fName - the field name.
Returns:
the non-negative field number, -1 if field name was not found

getFieldStructure

public FieldStructure getFieldStructure(int fIndex)
Get field structure for specified field number

Parameters:
fIndex - the field index, the first field is 0, second is 1.
Returns:
the field structure found, null otherwise

getFieldStructure

public FieldStructure getFieldStructure(java.lang.String fName)
Get field structure for specified field name

Parameters:
fName - the field name.
Returns:
the field structure found, null otherwise

toByteArray

public byte[] toByteArray()
Export current RecordStructure to binary form

Returns:
binary representation of RecordStructure
See Also:
RecordStructure(byte[] binaryForm)

jMobileCore toolkit