public class FastDateParser extends Object implements DateParser, Serializable
| Modifier | Constructor and Description |
|---|---|
protected |
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale)
Constructs a new FastDateParser.
|
protected |
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale,
Date centuryStart)
Constructs a new FastDateParser.
|
protected |
FastDateParser(String pattern,
TimeZone timeZone,
Locale locale,
Date centuryStart,
boolean lenient)
Constructs a new FastDateParser.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Compare another object for equality with this object.
|
Locale |
getLocale()
Get the locale used by this parser.
|
String |
getPattern()
Get the pattern used by this parser.
|
TimeZone |
getTimeZone()
Get the time zone used by this parser.
|
int |
hashCode()
Return a hashcode compatible with equals.
|
Date |
parse(String source)
Equivalent to DateFormat.parse(String).
|
Date |
parse(String source,
ParsePosition pos)
This implementation updates the ParsePosition if the parse succeeeds.
|
Object |
parseObject(String source)
Parses text from a string to produce a Date.
|
Object |
parseObject(String source,
ParsePosition pos)
Parse a date/time string according to the given parse position.
|
String |
toString()
Get a string version of this formatter.
|
protected FastDateParser(String pattern, TimeZone timeZone, Locale locale)
Constructs a new FastDateParser.
UseFastDateFormat.getInstance(String, TimeZone, Locale) or another variation of the factory methods of
FastDateFormat to get a cached FastDateParser instance.pattern - non-null SimpleDateFormat compatible patterntimeZone - non-null time zone to uselocale - non-null localeprotected FastDateParser(String pattern, TimeZone timeZone, Locale locale, Date centuryStart)
Constructs a new FastDateParser.
pattern - non-null SimpleDateFormat compatible patterntimeZone - non-null time zone to uselocale - non-null localecenturyStart - The start of the century for 2 digit year parsingprotected FastDateParser(String pattern, TimeZone timeZone, Locale locale, Date centuryStart, boolean lenient)
Constructs a new FastDateParser.
pattern - non-null SimpleDateFormat compatible patterntimeZone - non-null time zone to uselocale - non-null localecenturyStart - The start of the century for 2 digit year parsinglenient - if true, non-standard values for Calendar fields should be accepted; if false, non-standard values
will cause a ParseException to be thrown Calendar.setLenient(boolean)public String getPattern()
DateParsergetPattern in interface DateParserSimpleDateFormat compatiblepublic TimeZone getTimeZone()
DateParser
The default TimeZone used to create a Date when the TimeZone is not specified by the
format pattern.
getTimeZone in interface DateParserpublic Locale getLocale()
DateParsergetLocale in interface DateParserpublic boolean equals(Object obj)
Compare another object for equality with this object.
public int hashCode()
Return a hashcode compatible with equals.
public String toString()
Get a string version of this formatter.
public Object parseObject(String source) throws ParseException
DateParserparseObject in interface DateParsersource - A String whose beginning should be parsed.java.util.Date objectParseException - if the beginning of the specified string cannot be parsed.Format.parseObject(String)public Date parse(String source) throws ParseException
DateParserDateFormat.parse(String) for more information.parse in interface DateParsersource - A String whose beginning should be parsed.Date parsed from the stringParseException - if the beginning of the specified string cannot be parsed.public Object parseObject(String source, ParsePosition pos)
DateParserparseObject in interface DateParsersource - A String whose beginning should be parsed.pos - the parse positionjava.util.Date objectDateFormat.parseObject(String, ParsePosition)public Date parse(String source, ParsePosition pos)
SimpleDateFormat.parse(String, ParsePosition) it is not able to set the error Index - i.e.
ParsePosition.getErrorIndex() - if the parse fails.
To determine if the parse has succeeded, the caller must check if the current parse position given by
ParsePosition.getIndex() has been updated. If the input buffer has been fully parsed, then the index will
point to just after the end of the input buffer.
Equivalent to DateFormat.parse(String, ParsePosition).
See DateFormat.parse(String, ParsePosition) for more information.
parse in interface DateParsersource - A String, part of which should be parsed.pos - A ParsePosition object with index and error index information as described above.Date parsed from the string. In case of error, returns null.Copyright © 1999-2016 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.