org.das2.datum.format
Class TimeDatumFormatter

java.lang.Object
  extended by org.das2.datum.format.DatumFormatter
      extended by org.das2.datum.format.TimeDatumFormatter

public class TimeDatumFormatter
extends DatumFormatter


Field Summary
static TimeDatumFormatter DAYS
          yyyy-MM-dd
static TimeDatumFormatter DEFAULT
          yyyy-MM-dd'T'HH:mm:ss.SSS'Z
static TimeDatumFormatter HOURS
          yyyy-MM-dd HH:'00'
static TimeDatumFormatter MICROSECONDS
          HH:mm:ss.SSSSSS
static TimeDatumFormatter MILLISECONDS
          HH:mm:ss.SSS
static TimeDatumFormatter MINUTES
          HH:mm
static TimeDatumFormatter MONTHS
          yyyy-MM
static TimeDatumFormatter NANOSECONDS
          HH:mm:ss.SSSSSSSSS
static TimeDatumFormatter SECONDS
          HH:mm:ss
static TimeDatumFormatter YEARS
          yyyy
 
Constructor Summary
TimeDatumFormatter(java.lang.String formatString)
          Creates a new instance of TimeDatumFormatter
 
Method Summary
 java.lang.String format(Datum datum)
           
static TimeDatumFormatter formatterForScale(int scale, DatumRange context)
          returns a TimeDatumFormatter suitable for the specified scale and context.
protected  java.text.Format getFormat()
           
protected  java.lang.String parseTimeFormatString(java.lang.String input)
           
protected  java.lang.String parseTimeFormatStringPercent(java.lang.String format)
          create the message format, based on %Y, %m, %d format specification.
 java.lang.String toString()
           
 
Methods inherited from class org.das2.datum.format.DatumFormatter
axisFormat, format, grannyFormat, grannyFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final TimeDatumFormatter DEFAULT
yyyy-MM-dd'T'HH:mm:ss.SSS'Z


DAYS

public static final TimeDatumFormatter DAYS
yyyy-MM-dd


YEARS

public static final TimeDatumFormatter YEARS
yyyy


MONTHS

public static final TimeDatumFormatter MONTHS
yyyy-MM


HOURS

public static final TimeDatumFormatter HOURS
yyyy-MM-dd HH:'00'


MINUTES

public static final TimeDatumFormatter MINUTES
HH:mm


SECONDS

public static final TimeDatumFormatter SECONDS
HH:mm:ss


MILLISECONDS

public static final TimeDatumFormatter MILLISECONDS
HH:mm:ss.SSS


MICROSECONDS

public static final TimeDatumFormatter MICROSECONDS
HH:mm:ss.SSSSSS


NANOSECONDS

public static final TimeDatumFormatter NANOSECONDS
HH:mm:ss.SSSSSSSSS

Constructor Detail

TimeDatumFormatter

public TimeDatumFormatter(java.lang.String formatString)
                   throws java.text.ParseException
Creates a new instance of TimeDatumFormatter

Throws:
java.text.ParseException
Method Detail

formatterForScale

public static TimeDatumFormatter formatterForScale(int scale,
                                                   DatumRange context)
returns a TimeDatumFormatter suitable for the specified scale and context. Context may be null to indicate that the formatted string will be interpretted outside of any context.

Parameters:
scale - the length we wish to represent, such as TimeUtil.HOUR
context - the context for the formatter, or null if the formatted string will be interpretted outside of any context.
Throws:
java.lang.IllegalArgumentException - if the scale is TimeUtil.NANOS or is not found in TimeUtil.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

format

public java.lang.String format(Datum datum)
Specified by:
format in class DatumFormatter

getFormat

protected java.text.Format getFormat()

parseTimeFormatString

protected java.lang.String parseTimeFormatString(java.lang.String input)
                                          throws java.text.ParseException
Throws:
java.text.ParseException

parseTimeFormatStringPercent

protected java.lang.String parseTimeFormatStringPercent(java.lang.String format)
                                                 throws java.text.ParseException
create the message format, based on %Y, %m, %d format specification.

Parameters:
input -
Returns:
Throws:
java.text.ParseException