org.apache.jackrabbit.core.query.lucene
Class DateField

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.DateField

public class DateField
extends Object

Implements Date <-> String conversions in a way that the resulting String is suitable for indexing and sorting.


Field Summary
static String MAX_DATE_STRING
          Returns 'zzzzzzzzz' -> something around 3189
static String MIN_DATE_STRING
          Returns '000000000' -> something around 30 BC
 
Method Summary
static String dateToString(Date date)
          Converts a Date to a string suitable for indexing.
static Date stringToDate(String s)
          Converts a string-encoded date into a Date object.
static long stringToTime(String s)
          Converts a string-encoded date into a millisecond time.
static String timeToString(long time)
          Converts a millisecond time to a string suitable for indexing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_DATE_STRING

public static final String MIN_DATE_STRING
Returns '000000000' -> something around 30 BC


MAX_DATE_STRING

public static final String MAX_DATE_STRING
Returns 'zzzzzzzzz' -> something around 3189

Method Detail

dateToString

public static String dateToString(Date date)
Converts a Date to a string suitable for indexing. This method will throw a RuntimeException if the date specified in the method argument is before 30 BC or after 3189.


timeToString

public static String timeToString(long time)
Converts a millisecond time to a string suitable for indexing. Supported date range is: 30 BC - 3189

Throws:
IllegalArgumentException - if the given time is not within the supported date range.

stringToTime

public static long stringToTime(String s)
Converts a string-encoded date into a millisecond time.


stringToDate

public static Date stringToDate(String s)
Converts a string-encoded date into a Date object.



Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.