net.sourceforge.annovalidator.util
Enum DateUtil.DatePartType

java.lang.Object
  extended by java.lang.Enum<DateUtil.DatePartType>
      extended by net.sourceforge.annovalidator.util.DateUtil.DatePartType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DateUtil.DatePartType>
Enclosing class:
DateUtil

public static enum DateUtil.DatePartType
extends java.lang.Enum<DateUtil.DatePartType>

Identifies part of a date, and identifies the format pattern required to parse that portion of the date.


Nested Class Summary
static class DateUtil.DatePartType.UnrecognisedDatePartException
          Exception indicating that a given value does not match any known date formatting pattern.
 
Enum Constant Summary
DAY
          Date part is a day.
HOUR
          Date part is an hour.
MINUTE
          Date part is a minute.
MONTH
          Date part is a month.
SECOND
          Date part is a second.
YEAR
          Date part is a year.
 
Method Summary
 java.lang.String determineFormatPatternForDatePart(java.lang.String value)
          Returns the date formatting pattern that matches value for the current DatePartType.
 java.lang.String[][] getValidSeperators()
           
static DateUtil.DatePartType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static DateUtil.DatePartType[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DAY

public static final DateUtil.DatePartType DAY
Date part is a day.

Supports the following formats:


MONTH

public static final DateUtil.DatePartType MONTH
Date part is a month.

Supports the following formats:


YEAR

public static final DateUtil.DatePartType YEAR
Date part is a year.

Supports the following formats:


HOUR

public static final DateUtil.DatePartType HOUR
Date part is an hour.

Supports the following formats:


MINUTE

public static final DateUtil.DatePartType MINUTE
Date part is a minute.

Supports the following formats:


SECOND

public static final DateUtil.DatePartType SECOND
Date part is a second.

Supports the following formats:

Method Detail

values

public static final DateUtil.DatePartType[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(DateUtil.DatePartType c : DateUtil.DatePartType.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static DateUtil.DatePartType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getValidSeperators

public java.lang.String[][] getValidSeperators()

determineFormatPatternForDatePart

public java.lang.String determineFormatPatternForDatePart(java.lang.String value)
                                                   throws DateUtil.DatePartType.UnrecognisedDatePartException
Returns the date formatting pattern that matches value for the current DatePartType.

Parameters:
value - The value to try and match.
Throws:
DateUtil.DatePartType.UnrecognisedDatePartException - If no matching pattern can be found.


Copyright © 2008. All Rights Reserved.