org.xBaseJ.fields
Class DateField

java.lang.Object
  extended byorg.xBaseJ.fields.Field
      extended byorg.xBaseJ.fields.DateField
All Implemented Interfaces:
Cloneable, Externalizable, Serializable

public class DateField
extends Field

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.xBaseJ.fields.Field
buffer, bytebuffer, Deleted, Length, myoffset, Name, otherValidCharacters
 
Constructor Summary
DateField(String iName)
          public method for creating a DateField object.
DateField(String iName, java.nio.ByteBuffer inBuffer)
           
 
Method Summary
 Object clone()
           
 int compareTo(Calendar compareThis)
          public method for comparing a Java Calendar object.
 int compareTo(DateField compareThis)
          public method for comparing a DateField object.
 String get(int field)
          public method for getting individual field values
 Calendar getCalendar()
          public method for returing the date field in a Java Calendar object.
 char getType()
          return the character 'D' indicating a date field
 void put(Calendar inValue)
          sets field contents by a Java Calendar object.
 void put(Date inValue)
          sets field contents by a Java Date object.
 void put(long inValue)
          sets field contents by a long value
 void put(String inValue)
          sets field contents by a String parameter.
 void set(int field, int value)
          public method for setting individual field values
 
Methods inherited from class org.xBaseJ.fields.Field
get, getBytes, getDecimalPositionCount, getLength, getName, put, read, readExternal, setBuffer, setBufferSpace, setField, update, write, writeExternal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateField

public DateField(String iName,
                 java.nio.ByteBuffer inBuffer)
          throws xBaseJException

DateField

public DateField(String iName)
          throws IOException,
                 xBaseJException
public method for creating a DateField object. It is not associated with a database but can be when used with some DBF methods.

Parameters:
iName - the name of the field
Throws:
xBaseJException - exception caused in calling methods
IOException - can not occur but defined for calling methods
See Also:
Field
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Field
Throws:
CloneNotSupportedException

getType

public char getType()
return the character 'D' indicating a date field

Overrides:
getType in class Field
Returns:
char field type

put

public void put(String inValue)
         throws xBaseJException
sets field contents by a String parameter.

Overrides:
put in class Field
Parameters:
inValue - String value to store - format CCYYMMDD
Throws:
xBaseJException - most likely a format error

put

public void put(Date inValue)
         throws xBaseJException
sets field contents by a Java Date object.

Parameters:
inValue - java.util.Date value to store
Throws:
xBaseJException - most likely a format error

put

public void put(Calendar inValue)
         throws xBaseJException
sets field contents by a Java Calendar object.

Parameters:
inValue - java.util.Calendare value to store
Throws:
xBaseJException - most likely a format error

put

public void put(long inValue)
         throws xBaseJException
sets field contents by a long value

Parameters:
inValue - long value to store - format CCYYMMDD
Throws:
xBaseJException - most likely a format error

compareTo

public int compareTo(DateField compareThis)
public method for comparing a DateField object.

Parameters:
compareThis - the other DateField object to compare
Returns:
negative if compareThis is larger, zero if equal, positive if smaller

compareTo

public int compareTo(Calendar compareThis)
              throws xBaseJException
public method for comparing a Java Calendar object.

Parameters:
compareThis - the Date object to compare
Returns:
negative if compareThis is larger, zero if equal, positive if smaller
Throws:
xBaseJException - exception caused in calling methods

getCalendar

public Calendar getCalendar()
                     throws xBaseJException
public method for returing the date field in a Java Calendar object.

Returns:
a Calendaar object
Throws:
xBaseJException - exception caused in calling methods

get

public String get(int field)
           throws xBaseJException
public method for getting individual field values

Parameters:
field - id, use Calendar.YEAR, Calendar.MONTh, Calendar.DAY_OF_MONTH
Returns:
String of fields value
Throws:
xBaseJException - exception caused in calling methods

set

public void set(int field,
                int value)
         throws xBaseJException
public method for setting individual field values

Parameters:
field - use Calendar.YEAR, Calendar.MONTh, Calendar.DAY_OF_MONTH
value - - int value to set field
Returns:
String of fields value
Throws:
xBaseJException - exception caused in calling methods


Copyright 1997-2007 American Coders Ltd. All Rights Reserved.