public abstract class AbstractSiteMap extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AbstractSiteMap.SitemapType
Various Sitemap types
|
Modifier and Type | Field and Description |
---|---|
protected static java.time.ZoneId |
TIME_ZONE_UTC |
protected URL |
url |
static java.time.format.DateTimeFormatter |
W3C_FULLDATE_FORMATTER
DateTimeFormatter for parsing dates in ISO-8601 format
|
static java.time.format.DateTimeFormatter |
W3C_FULLDATE_FORMATTER_UTC
DateTimeFormatter to format dates in ISO-8601 format (UTC time zone 'Z')
|
static java.time.format.DateTimeFormatter |
W3C_SHORTDATE_FORMATTER
DateTimeFormatter for parsing short dates ('1997', '1997-07',
'1997-07-16') without daytime and time zone
|
Constructor and Description |
---|
AbstractSiteMap() |
Modifier and Type | Method and Description |
---|---|
static Date |
convertToDate(String date)
|
static java.time.ZonedDateTime |
convertToZonedDateTime(String date)
Convert the given date (given in an acceptable DateFormat), return null
if the date is not in the correct format.
|
Date |
getLastModified() |
AbstractSiteMap.SitemapType |
getType() |
URL |
getUrl() |
boolean |
isIndex() |
boolean |
isProcessed() |
static String |
normalizeRSSTimestamp(String pubDate)
Converts pubDate of RSS to the ISO-8601 instant format, e.g.,
'2017-01-05T12:34:54Z' in UTC / GMT time zone, see
DateTimeFormatter.ISO_INSTANT . |
static java.time.ZonedDateTime |
parseRSSTimestamp(String pubDate)
Parse pubDate of RSS feeds.
|
void |
setLastModified(Date lastModified) |
void |
setLastModified(String lastModified) |
void |
setLastModified(java.time.ZonedDateTime lastModified) |
void |
setProcessed(boolean processed) |
void |
setType(AbstractSiteMap.SitemapType type) |
protected static final java.time.ZoneId TIME_ZONE_UTC
public static final java.time.format.DateTimeFormatter W3C_FULLDATE_FORMATTER
public static final java.time.format.DateTimeFormatter W3C_FULLDATE_FORMATTER_UTC
public static final java.time.format.DateTimeFormatter W3C_SHORTDATE_FORMATTER
protected URL url
public boolean isIndex()
public URL getUrl()
public void setType(AbstractSiteMap.SitemapType type)
type
- the Sitemap type to setpublic AbstractSiteMap.SitemapType getType()
public void setProcessed(boolean processed)
processed
- - indicate if the Sitemap has been processed.public boolean isProcessed()
public void setLastModified(Date lastModified)
lastModified
- the last-modified datepublic void setLastModified(java.time.ZonedDateTime lastModified)
lastModified
- the last-modified date and timepublic void setLastModified(String lastModified)
lastModified
- the last-modified date time. If parsing of the given date time
fails, the last-modified field is set to null.public Date getLastModified()
public static java.time.ZonedDateTime convertToZonedDateTime(String date)
Dates must follow the W3C Datetime format which is similar to ISO-8601 but allows dates with different precisions:
Year: YYYY (eg 1997) Year and month: YYYY-MM (eg 1997-07) Complete date: YYYY-MM-DD (eg 1997-07-16) Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) Complete date plus hours, minutes and seconds: YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) Complete date plus hours, minutes, seconds and a decimal fraction of a second YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)Note: Greenwich time (UTC) is assumed if the date string does not specify a time zone.
date
- - the date to be parsedpublic static Date convertToDate(String date)
date
- the date string to convertpublic static String normalizeRSSTimestamp(String pubDate)
DateTimeFormatter.ISO_INSTANT
.pubDate
- - date time of pubDate in RFC822public static java.time.ZonedDateTime parseRSSTimestamp(String pubDate)
pubDate
- - date time of pubDate in RFC822Copyright © 2009–2021 Crawler-Commons. All rights reserved.