com.svcon.jdbf
Class JDBField

java.lang.Object
  |
  +--com.svcon.jdbf.JDBField

public class JDBField
extends java.lang.Object

A database field. Its attributes are name, type, length, and decimal count.


Constructor Summary
JDBField(java.lang.String name, char type, int length, int decimalCount)
          Construct a database field with a given name, type, length, and decimal count.
 
Method Summary
 java.lang.String format(java.lang.Object value)
          Formats a value to its String representation, based on the fields parameters.
 int getDecimalCount()
          Returns the decimal count of the field.
 int getLength()
          Returns the length of the field.
 java.lang.String getName()
          Returns the name of the field.
 char getType()
          Returns the type of the field.
 java.lang.Object parse(java.lang.String value)
          Parses a formatted String and returns an object of type, corresponding to this field.
 java.lang.String toString()
          Returns the String representation of the JDBField.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDBField

public JDBField(java.lang.String name,
                char type,
                int length,
                int decimalCount)
         throws JDBFException
Construct a database field with a given name, type, length, and decimal count.
Parameters:
name - the name of the field.
type - the type of the field. It needs to be one of the following characters: 'N' - numeric; 'C' - character; 'L' - logical; 'D' - date; 'F' - floating point.
length - the length of the field.
decimalCount - the number of decimal positions after the decimal point.
Throws:
JDBFException - if the parameters passed do not comply with the DBF specs.
Method Detail

getName

public java.lang.String getName()
Returns the name of the field.
Returns:
the name of the field.

getType

public char getType()
Returns the type of the field.
Returns:
the type of the field.

getLength

public int getLength()
Returns the length of the field.
Returns:
the length of the field.

getDecimalCount

public int getDecimalCount()
Returns the decimal count of the field.
Returns:
the decimal count of the field.

format

public java.lang.String format(java.lang.Object value)
                        throws JDBFException
Formats a value to its String representation, based on the fields parameters.
Parameters:
value - the value
Returns:
the String representation.
Throws:
JDBFException - if the value passed cannot be formatted.

parse

public java.lang.Object parse(java.lang.String value)
                       throws JDBFException
Parses a formatted String and returns an object of type, corresponding to this field.
Parameters:
value - the String value.
Returns:
the result object.
Throws:
JDBFException - if the value passed cannot be parsed.

toString

public java.lang.String toString()
Returns the String representation of the JDBField.
Overrides:
toString in class java.lang.Object
Returns:
the name of the JDBField.