KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ziclix > python > sql > DateFactory


1 /*
2  * Jython Database Specification API 2.0
3  *
4  * $Id: DateFactory.java,v 1.3 2005/02/23 04:26:18 bzimmer Exp $
5  *
6  * Copyright (c) 2003 brian zimmer <bzimmer@ziclix.com>
7  *
8  */

9 package com.ziclix.python.sql;
10
11 import org.python.core.PyObject;
12
13 /**
14  * Provide an extensible way to create dates for zxJDBC.
15  *
16  * @author brian zimmer
17  * @author last revised by $Author: bzimmer $
18  * @version $Revision: 1.3 $
19  */

20 public interface DateFactory {
21
22     /**
23      * This function constructs an object holding a date value.
24      *
25      * @param year
26      * @param month
27      * @param day
28      * @return PyObject
29      */

30     public PyObject Date(int year, int month, int day);
31
32     /**
33      * This function constructs an object holding a time value.
34      *
35      * @param hour
36      * @param minute
37      * @param second
38      * @return PyObject
39      */

40     public PyObject Time(int hour, int minute, int second);
41
42     /**
43      * This function constructs an object holding a time stamp value.
44      *
45      * @param year
46      * @param month
47      * @param day
48      * @param hour
49      * @param minute
50      * @param second
51      * @return PyObject
52      */

53     public PyObject Timestamp(int year, int month, int day, int hour, int minute, int second);
54
55     /**
56      * This function constructs an object holding a date value from the
57      * given ticks value (number of seconds since the epoch; see the
58      * documentation of the standard Python <i>time</i> module for details).
59      * <p/>
60      * <i>Note:</i> The DB API 2.0 spec calls for time in seconds since the epoch
61      * while the Java Date object returns time in milliseconds since the epoch.
62      * This module adheres to the python API and will therefore use time in
63      * seconds rather than milliseconds, so adjust any Java code accordingly.
64      *
65      * @param ticks number of seconds since the epoch
66      * @return PyObject
67      */

68     public PyObject DateFromTicks(long ticks);
69
70     /**
71      * This function constructs an object holding a time value from the
72      * given ticks value (number of seconds since the epoch; see the
73      * documentation of the standard Python <i>time</i> module for details).
74      * <p/>
75      * <i>Note:</i> The DB API 2.0 spec calls for time in seconds since the epoch
76      * while the Java Date object returns time in milliseconds since the epoch.
77      * This module adheres to the python API and will therefore use time in
78      * seconds rather than milliseconds, so adjust any Java code accordingly.
79      *
80      * @param ticks number of seconds since the epoch
81      * @return PyObject
82      */

83     public PyObject TimeFromTicks(long ticks);
84
85     /**
86      * This function constructs an object holding a time stamp value from
87      * the given ticks value (number of seconds since the epoch; see the
88      * documentation of the standard Python <i>time</i> module for details).
89      * <p/>
90      * <i>Note:</i> The DB API 2.0 spec calls for time in seconds since the epoch
91      * while the Java Date object returns time in milliseconds since the epoch.
92      * This module adheres to the python API and will therefore use time in
93      * seconds rather than milliseconds, so adjust any Java code accordingly.
94      *
95      * @param ticks number of seconds since the epoch
96      * @return PyObject
97      */

98     public PyObject TimestampFromTicks(long ticks);
99
100 }
101
Popular Tags