org.mycore.datamodel.metadata
Class MCRMetaISO8601Date.FormatChooser

java.lang.Object
  extended by org.mycore.datamodel.metadata.MCRMetaISO8601Date.FormatChooser
Enclosing class:
MCRMetaISO8601Date

protected static final class MCRMetaISO8601Date.FormatChooser
extends Object

is a helper class for MCRMetaISO8601Date. Please be aware that this class is not supported. It may disappear some day or methods get removed.

Since:
1.3
Version:
$Revision: 15160 $ $Date: 2009-05-08 09:35:46 +0200 (Fri, 08 May 2009) $
Author:
Thomas Scheffler (yagee)

Field Summary
protected static org.joda.time.format.DateTimeFormatter COMPLETE_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter COMPLETE_HH_MM_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter COMPLETE_HH_MM_SS_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter COMPLETE_HH_MM_SS_SSS_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter UTC_COMPLETE_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter UTC_COMPLETE_HH_MM_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter UTC_COMPLETE_HH_MM_SS_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter UTC_COMPLETE_HH_MM_SS_SSS_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter UTC_YEAR_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter UTC_YEAR_MONTH_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter YEAR_FORMAT
           
protected static org.joda.time.format.DateTimeFormatter YEAR_MONTH_FORMAT
           
 
Constructor Summary
protected MCRMetaISO8601Date.FormatChooser()
           
 
Method Summary
static String cropSecondFractions(String isoString)
          returns a String that has not more than 3 digits representing "fractions of a second".
static org.joda.time.format.DateTimeFormatter getFormatter(String isoString, MCRMetaISO8601Date.IsoFormat isoFormat)
          returns a DateTimeFormatter for the given isoString or format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YEAR_FORMAT

protected static final org.joda.time.format.DateTimeFormatter YEAR_FORMAT

YEAR_MONTH_FORMAT

protected static final org.joda.time.format.DateTimeFormatter YEAR_MONTH_FORMAT

COMPLETE_FORMAT

protected static final org.joda.time.format.DateTimeFormatter COMPLETE_FORMAT

COMPLETE_HH_MM_FORMAT

protected static final org.joda.time.format.DateTimeFormatter COMPLETE_HH_MM_FORMAT

COMPLETE_HH_MM_SS_FORMAT

protected static final org.joda.time.format.DateTimeFormatter COMPLETE_HH_MM_SS_FORMAT

COMPLETE_HH_MM_SS_SSS_FORMAT

protected static final org.joda.time.format.DateTimeFormatter COMPLETE_HH_MM_SS_SSS_FORMAT

UTC_YEAR_FORMAT

protected static final org.joda.time.format.DateTimeFormatter UTC_YEAR_FORMAT

UTC_YEAR_MONTH_FORMAT

protected static final org.joda.time.format.DateTimeFormatter UTC_YEAR_MONTH_FORMAT

UTC_COMPLETE_FORMAT

protected static final org.joda.time.format.DateTimeFormatter UTC_COMPLETE_FORMAT

UTC_COMPLETE_HH_MM_FORMAT

protected static final org.joda.time.format.DateTimeFormatter UTC_COMPLETE_HH_MM_FORMAT

UTC_COMPLETE_HH_MM_SS_FORMAT

protected static final org.joda.time.format.DateTimeFormatter UTC_COMPLETE_HH_MM_SS_FORMAT

UTC_COMPLETE_HH_MM_SS_SSS_FORMAT

protected static final org.joda.time.format.DateTimeFormatter UTC_COMPLETE_HH_MM_SS_SSS_FORMAT
Constructor Detail

MCRMetaISO8601Date.FormatChooser

protected MCRMetaISO8601Date.FormatChooser()
Method Detail

getFormatter

public static org.joda.time.format.DateTimeFormatter getFormatter(String isoString,
                                                                  MCRMetaISO8601Date.IsoFormat isoFormat)
returns a DateTimeFormatter for the given isoString or format. This method prefers the format parameter. So if it's not null or not zero length this method will interpret the format string. You can also get a formatter for e specific iso String. In either case if the underlying algorithm can not determine an exact matching formatter it will allway fall back to a default. So this method will never return null.

Parameters:
isoString - an ISO 8601 formatted time String, or null
isoFormat - a valid format String, or null
Returns:
returns a specific DateTimeFormatter

cropSecondFractions

public static final String cropSecondFractions(String isoString)
returns a String that has not more than 3 digits representing "fractions of a second". If isoString has no or not more than 3 digits this method simply returns isoString.

Parameters:
isoString - an ISO 8601 formatted time String
Returns:
an ISO 8601 formatted time String with at max 3 digits for fractions of a second