IMC Epclient 5.0.3

at.spardat.enterprise.fmt
Class ADateFmt

java.lang.Object
  extended byat.spardat.enterprise.fmt.IFmt
      extended byat.spardat.enterprise.fmt.ADateFmt
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ADateFmtJavaUtilText, ADateFmtMediumSmart

public abstract class ADateFmt
extends IFmt

This class supports formatting and parsig ADates. What makes this class different from java.text.DateFormat is the better implementation of the MEDIUM style. To put it briefly, you should only use the MEDIUM style for parsing of dates. Moreover, the formatting of dates with format MEDIUM has been highly optimized.

For styles other than MEDIUM, the implementation falls back to java.text.DateFormat.


Field Summary
static int FULL
          A very verbose representation, see java.text.DateFormat.FULL.
static int LONG
          A longer representation of a date, see java.text.DateFormat.LONG.
static int MEDIUM
          This is the default style.
static int SHORT
          denotes a predefined format, see java.text.DateFormat.SHORT.
 
Fields inherited from class at.spardat.enterprise.fmt.IFmt
DEFAULT, LAST_STYLE, MANDATORY, style_
 
Constructor Summary
ADateFmt()
           
 
Method Summary
protected  void checkDateRange(java.lang.String internal)
          Utility-method that checks the date-ranges, if any.
static ADateFmt getInstance(int style, java.util.Locale locale)
          Returns an IFmt providing a style and a locale.
static ADateFmt getInstance(int style, java.util.Locale locale, int minDayRel, int maxDayRel)
          Returns an IFmt providing a style and a locale.
static ADateFmt getInstance(int style, java.util.Locale locale, int minDayRel, int maxDayRel, java.lang.String minDate, java.lang.String maxDate)
          Returns an IFmt providing a style and a locale.
static ADateFmt getInstance(int style, java.util.Locale locale, java.lang.String minDate, java.lang.String maxDate)
          Returns an IFmt providing a style and a locale.
static ADateFmt getInstance(java.lang.String pattern)
          Constructs an ADateFmt providing a pattern as specified in java.text.SimpleDateFormat.
static ADateFmt getInstance(java.lang.String pattern, int style)
          Constructs an ADateFmt providing a pattern as specified in java.text.SimpleDateFormat.
static ADateFmt getInstance(java.lang.String pattern, int style, java.util.Locale locale)
          Constructs an ADateFmt providing a pattern as specified in java.text.SimpleDateFormat.
 int getMax()
          Returns the upper bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow.
 java.lang.String getMaxDate()
          Returns the upper bound for a date in the format yyyyMMdd, or null if no such restriction is set.
 int getMin()
          Returns the lower bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow.
 java.lang.String getMinDate()
          Returns the lower bound for a date in the format yyyyMMdd, or null if no such restriction is set.
 boolean isLegalInternal(java.lang.String internal)
          Determines if the given string is a legal internal representation.
 boolean mayBeAppliedTo(byte type)
          Defines if this formatter is able to successfully format a specified type.
 void setMax(int i)
          Allows to set the upper bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow.
 void setMaxDate(java.lang.String maxDate)
          Set the upper bound for a date in the format yyyyMMdd.
 void setMin(int i)
          Allows to set the lower bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow.
 void setMinDate(java.lang.String minDate)
          Set the lower bound for a date in the format yyyyMMdd.
 
Methods inherited from class at.spardat.enterprise.fmt.IFmt
checkMandatory, clone, format, getStyle, isLegalExternalChar, isMandatory, isOneWay, maxLenOfExternal, parse, setMandatory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHORT

public static final int SHORT
denotes a predefined format, see java.text.DateFormat.SHORT. In most locales, the year is just of two digits, therefore not adequate for input. Example: '24.04.00'

See Also:
Constant Field Values

MEDIUM

public static final int MEDIUM
This is the default style. It is the preferred style for entering dates, since there is much input support, also see ADateFmtMediumSmart. Example: '24.04.2000'

See Also:
Constant Field Values

LONG

public static final int LONG
A longer representation of a date, see java.text.DateFormat.LONG. Example: '24. April 2000'

See Also:
Constant Field Values

FULL

public static final int FULL
A very verbose representation, see java.text.DateFormat.FULL. Example: 'Montag, 24. April 2000'

See Also:
Constant Field Values
Constructor Detail

ADateFmt

public ADateFmt()
Method Detail

getInstance

public static ADateFmt getInstance(int style,
                                   java.util.Locale locale)
Returns an IFmt providing a style and a locale. For style DEFAULT or MEDIUM, an efficient implementation with convenient input support is returned, for other styles, the default implementation of JDK is used.

Parameters:
style - one of SHORT, MEDIUM, LONG or FULL or one of the IFmt-styles.
locale - the locale to use

getInstance

public static ADateFmt getInstance(int style,
                                   java.util.Locale locale,
                                   int minDayRel,
                                   int maxDayRel)
Returns an IFmt providing a style and a locale. For style DEFAULT or MEDIUM, an efficient implementation with convenient input support is returned, for other styles, the default implementation of JDK is used.

Parameters:
style - one of SHORT, MEDIUM, LONG or FULL or one of the IFmt-styles.
locale - the locale to use
minDayRel - lower bound on acceptable dates expressed as day-offset relative to today, i.e., -1 is yesterday, 0 is today, 1 stands for tomorrow. Integer.MAX_VALUE stands for no restriction.
maxDayRel - upper bound on acceptable dates expressed as day-offset relative to today, i.e., -1 is yesterday, 0 is today, 1 stands for tomorrow. Integer.MAX_VALUE stands for no restriction.

getInstance

public static ADateFmt getInstance(int style,
                                   java.util.Locale locale,
                                   java.lang.String minDate,
                                   java.lang.String maxDate)
Returns an IFmt providing a style and a locale. For style DEFAULT or MEDIUM, an efficient implementation with convenient input support is returned, for other styles, the default implementation of JDK is used.

Parameters:
style - one of SHORT, MEDIUM, LONG or FULL or one of the IFmt-styles.
locale - the locale to use
minDate - lower bound on acceptable dates in the format yyyyMMdd. null and "" stand for no restriction.
maxDate - upper bound on acceptable dates in the format yyyyMMdd. null and "" stand for no restriction.

getInstance

public static ADateFmt getInstance(int style,
                                   java.util.Locale locale,
                                   int minDayRel,
                                   int maxDayRel,
                                   java.lang.String minDate,
                                   java.lang.String maxDate)
Returns an IFmt providing a style and a locale. For style DEFAULT or MEDIUM, an efficient implementation with convenient input support is returned, for other styles, the default implementation of JDK is used.

Parameters:
style - one of SHORT, MEDIUM, LONG or FULL or one of the IFmt-styles.
locale - the locale to use
minDayRel - lower bound on acceptable dates expressed as day-offset relative to today, i.e., -1 is yesterday, 0 is today, 1 stands for tomorrow. Integer.MAX_VALUE stands for no restriction.
maxDayRel - upper bound on acceptable dates expressed as day-offset relative to today, i.e., -1 is yesterday, 0 is today, 1 stands for tomorrow. Integer.MAX_VALUE stands for no restriction.
minDate - lower bound on acceptable dates in the format yyyyMMdd. null and "" stand for no restriction.
maxDate - upper bound on acceptable dates in the format yyyyMMdd. null and "" stand for no restriction.

getInstance

public static ADateFmt getInstance(java.lang.String pattern)
Constructs an ADateFmt providing a pattern as specified in java.text.SimpleDateFormat.


getInstance

public static ADateFmt getInstance(java.lang.String pattern,
                                   int style)
Constructs an ADateFmt providing a pattern as specified in java.text.SimpleDateFormat.

Parameters:
pattern - a SimpleDateFormat pattern.
style - may be MANDATORY

getInstance

public static ADateFmt getInstance(java.lang.String pattern,
                                   int style,
                                   java.util.Locale locale)
Constructs an ADateFmt providing a pattern as specified in java.text.SimpleDateFormat.

Parameters:
pattern - a SimpleDateFormat pattern.
style - may be MANDATORY
locale - as used in java.text.SimpleDateFormat

isLegalInternal

public boolean isLegalInternal(java.lang.String internal)
Description copied from class: IFmt
Determines if the given string is a legal internal representation.

Specified by:
isLegalInternal in class IFmt
Parameters:
internal - the internal encoding.
Returns:
whether the provided string follows a legal internal encoding.
See Also:
IFmt.isLegalInternal(String)

mayBeAppliedTo

public boolean mayBeAppliedTo(byte type)
Description copied from class: IFmt
Defines if this formatter is able to successfully format a specified type.

Specified by:
mayBeAppliedTo in class IFmt
Parameters:
type - a type constant defined in Types.
See Also:
IFmt.mayBeAppliedTo(byte)

getMax

public int getMax()
Returns the upper bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow. Integer.MAX_VALUE means that there is no upper bound.


getMin

public int getMin()
Returns the lower bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow. Integer.MAX_VALUE means that there is no lower bound.


setMax

public void setMax(int i)
Allows to set the upper bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow. Integer.MAX_VALUE means that there is no upper bound.


setMin

public void setMin(int i)
Allows to set the lower bound for a date that is specified relatively to the current date. -1 is yesterday, 0 is today and 1 denotes tomorrow. Integer.MAX_VALUE means that there is no lower bound.


getMaxDate

public java.lang.String getMaxDate()
Returns the upper bound for a date in the format yyyyMMdd, or null if no such restriction is set.


setMaxDate

public void setMaxDate(java.lang.String maxDate)
Set the upper bound for a date in the format yyyyMMdd. null and "" mean no restriction.


getMinDate

public java.lang.String getMinDate()
Returns the lower bound for a date in the format yyyyMMdd, or null if no such restriction is set.


setMinDate

public void setMinDate(java.lang.String minDate)
Set the lower bound for a date in the format yyyyMMdd. null and "" mean no restriction.


checkDateRange

protected void checkDateRange(java.lang.String internal)
Utility-method that checks the date-ranges, if any. Must be called from subclasses in their parse-method.

Parameters:
internal - internal date String.

IMC Epclient 5.0.3