Class SeparatorSymbol
java.lang.Object
com.aquima.interactions.foundation.text.symbol.SeparatorSymbol
- All Implemented Interfaces:
IDateSymbol
,Serializable
This class represents a separator in a date/time string representation of a Date object. Several commonly used
instances are defined as public members of this class. These public members are 'imported' in de DateFormat class as
a matter of convenience.
- Since:
- 5.1
- Author:
- C. de Meijer
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
format
(Calendar c, StringBuffer sb) Formats this symbol separator.Return the pattern representation of this NumberSymbol.Returns this SeparatorSymbol's instance's symbol.int
getWidth()
Returns the width of the separator symbol.int
Parses part of the dateString parameter.toString()
-
Constructor Details
-
SeparatorSymbol
Constructor for a new SeparatorSymbol.- Parameters:
symbol
- String denoting the Separator.- Throws:
NullPointerException
- if the symbol is null.IllegalArgumentException
- if the symbol is an empty string.IllegalArgumentException
- if the symbol contains one or more digits, to reduce the chance of ambiguity.
-
-
Method Details
-
format
Formats this symbol separator. It simply appends the separator symbol to the specified StringBuffer.- Specified by:
format
in interfaceIDateSymbol
- Parameters:
c
- Calendar object which holds the date/time that needs to be formatted. This parameter is ignored.sb
- StringBuffer in which to place the separator symbol.
-
getWidth
public int getWidth()Returns the width of the separator symbol.- Specified by:
getWidth
in interfaceIDateSymbol
- Returns:
- int The width of this separator symbol.
-
parse
Parses part of the dateString parameter. This method will return a negative integer if the symbol is not equal to the substring starting at pos and up to maxWidth characters of the dateString parameter.The result of this method may be the following:
- The width of this separator symbol upon succes.
- Negative integer indicating a parse error if the substring indicated by the pos and maxWidth parameters is not equal to this separator symbol. (Will be handled by DateFormat by throwing a ParseException indicating the position of the error).
- 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:
- The with of the separator symbol, or a negative number when a parse error was encountered.
-
getSymbol
Returns this SeparatorSymbol's instance's symbol.- Returns:
- String containing the separator symbol of this instance.
-
getPattern
Description copied from interface:IDateSymbol
Return the pattern representation of this NumberSymbol.- Specified by:
getPattern
in interfaceIDateSymbol
- Returns:
- String representing the pattern.
-
toString
-