| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.josql.functions.AbstractFunctionHandler
org.josql.functions.ConversionFunctions
public class ConversionFunctions
Note: creating new instances of SimpleDateFormat objects are VERY costly over large(ish) numbers of objects therefore a cache of objects is provided.
| Field Summary | |
|---|---|
| static String | DAYRepresents the Calendar.DATEfield, is: d. | 
| static String | DEFAULT_DATE_FORMAT_SPEC | 
| static String | DEFAULT_DATE_FORMAT_SPEC_2 | 
| static String | DEFAULT_DATE_FORMAT_SPEC_3 | 
| static String | HANDLER_ID | 
| static String | HOURRepresents the Calendar.HOUR_OF_DAYfield, is: h. | 
| static String | MINUTERepresents the Calendar.MINUTEfield, is: mi. | 
| static String | MONTHRepresents the Calendar.MONTHfield, is: m. | 
| static String | SECONDRepresents the Calendar.SECONDfield, is: s. | 
| static String | WEEKRepresents the Calendar.WEEK_OF_YEARfield, is: w. | 
| static String | YEARRepresents the Calendar.YEARfield, is: y. | 
| Fields inherited from class org.josql.functions.AbstractFunctionHandler | 
|---|
| q | 
| Constructor Summary | |
|---|---|
| ConversionFunctions() | |
| Method Summary | |
|---|---|
|  Date | addTime(Date d,
        Double amount,
        String type) | 
|  String | lower(Object o) | 
|  int | timeField(Object d,
          String type)This method (function) will return the associated field from a Calendarinstance. | 
|  Date | to_date(Object value) | 
|  Date | to_date(String value,
        String spec) | 
|  Number | to_number(Object o) | 
|  String | to_string(Object o) | 
|  Date | toDate(Object value) | 
|  Date | toDate(String value,
       String spec) | 
|  Long | toDateMillis(String value,
             String spec) | 
|  Long | toMillis(Date d) | 
|  Number | toNumber(Object o) | 
|  String | toString(Object o) | 
|  String | upper(Object o) | 
| Methods inherited from class org.josql.functions.AbstractFunctionHandler | 
|---|
| setQuery | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String HANDLER_ID
public static final String MINUTE
Calendar.MINUTE field, is: mi.
public static final String DAY
Calendar.DATE field, is: d.
public static final String YEAR
Calendar.YEAR field, is: y.
public static final String SECOND
Calendar.SECOND field, is: s.
public static final String HOUR
Calendar.HOUR_OF_DAY field, is: h.
public static final String MONTH
Calendar.MONTH field, is: m.
public static final String WEEK
Calendar.WEEK_OF_YEAR field, is: w.
public static String DEFAULT_DATE_FORMAT_SPEC
public static String DEFAULT_DATE_FORMAT_SPEC_2
public static String DEFAULT_DATE_FORMAT_SPEC_3
| Constructor Detail | 
|---|
public ConversionFunctions()
| Method Detail | 
|---|
public int timeField(Object d,
                     String type)
              throws QueryExecutionException
Calendar instance.  The type parm should be one of the 
 constants from this class.  The default TimeZone is used.
d - If the type is a long value then it is first converted to a Date.
          Or a Date should be used.type - The type of field to get.
Calendar.
QueryExecutionException - If the d parm isn't an instance of 
                                 Long or Date.
public Date addTime(Date d,
                    Double amount,
                    String type)
public Date toDate(Object value)
            throws QueryExecutionException
QueryExecutionException
public Date to_date(Object value)
             throws QueryExecutionException
QueryExecutionException
public Date to_date(String value,
                    String spec)
             throws QueryExecutionException
QueryExecutionException
public Date toDate(String value,
                   String spec)
            throws QueryExecutionException
QueryExecutionExceptionpublic Long toMillis(Date d)
public Long toDateMillis(String value,
                         String spec)
                  throws QueryExecutionException
QueryExecutionExceptionpublic String upper(Object o)
public String lower(Object o)
public String to_string(Object o)
public String toString(Object o)
public Number to_number(Object o)
public Number toNumber(Object o)
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||