Class AbstractFormatOnlySymbol
java.lang.Object
com.aquima.interactions.foundation.text.symbol.AbstractFormatOnlySymbol
- All Implemented Interfaces:
IDateSymbol
,Serializable
- Direct Known Subclasses:
LeadingZeroShortHourSymbol
,MeridiemMarkerSymbol
,ShortDateSymbol
,ShortHourSymbol
,ShortMonthSymbol
,ShortYearSymbol
,SpelledDayOfWeekSymbol
,SpelledDaySymbol
,SpelledMonthSymbol
,SpelledYearSymbol
Extend the AbstractFormatOnlySymbol when the symbol is for formatting dates only. When used for parsing of strings
this symbol throws an exception.
- Since:
- 6.0
- Author:
- Jon van Leuven
- See Also:
-
Constructor Details
-
AbstractFormatOnlySymbol
public AbstractFormatOnlySymbol()
-
-
Method Details
-
getWidth
public int getWidth()Description copied from interface:IDateSymbol
Returns the width of the symbol. When parsing a date string without separators, this width is used to calculate the expected total string length. When parsing a date string with separators, this width is used to limit the maximum amount of characters to consider. The result of this method is used during formatting to determine the number of leading zeroes required.- Specified by:
getWidth
in interfaceIDateSymbol
- Returns:
- int The width of this symbol.
-
parse
Description copied from interface:IDateSymbol
Parses part of the dateString parameter. This method may return a negative integer to indicate failure.- Specified by:
parse
in interfaceIDateSymbol
- Parameters:
dateString
- String value containing the date/time representation to be parsed.pos
- Integer value indicating the position at which to start parsing.maxWidth
- Integer value indicating the maximum number of characters to consume.- Returns:
- Non-negative integer containing the value parsed.
- Negative integer indicating a parse error. (Will be handled by DateFormat by throwing a ParseException indicating the position of the error).
-