# SiteMapURL (Crawler-commons 0.7 API)
Date: 2016-11-21

crawlercommons.sitemaps

## Class SiteMapURL

- java.lang.Object
- - crawlercommons.sitemaps.SiteMapURL

    public class SiteMapURL
    extends Object

The SitemapUrl class represents a URL found in a Sitemap.

Author:
  fmccown

### Nested Class Summary

Nested Classes
`static class` `SiteMapURL.ChangeFrequency` Allowed change frequencies

### Field Summary

Fields
`static double` `DEFAULT_PRIORITY`

### Constructor Summary

Constructors
Constructor and Description
`SiteMapURL(String url, boolean valid)`
`SiteMapURL(String url, String lastModified, String changeFreq, String priority, boolean valid)`
`SiteMapURL(URL url, boolean valid)`
`SiteMapURL(URL url, Date lastModified, SiteMapURL.ChangeFrequency changeFreq, double priority, boolean valid)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(Object o)`
`SiteMapURL.ChangeFrequency` `getChangeFrequency()` Return the URL's change frequency
`Date` `getLastModified()` Return when this URL was last modified.
`double` `getPriority()` Return this URL's priority (a value between [0.0 - 1.0]).
`URL` `getUrl()` Return the URL.
`int` `hashCode()`
`boolean` `isValid()` Is the siteMapURL under the base url ?
`void` `setChangeFrequency(SiteMapURL.ChangeFrequency changeFreq)` Set the URL's change frequency
`void` `setChangeFrequency(String changeFreq)` Set the URL's change frequency In case of a bad ChangeFrequency, the current frequency in this instance will be set to NULL
`void` `setLastModified(Date lastModified)` Set when this URL was last modified.
`void` `setLastModified(String lastModified)` Set when this URL was last modified.
`void` `setPriority(double priority)` Set the URL's priority to a value between [0.0 - 1.0] (Default Priority is used if the given priority is out of range).
`void` `setPriority(String priorityStr)` Set the URL's priority to a value between [0.0 - 1.0] (Default Priority is used if the given priority missing or is out of range).
`void` `setUrl(String url)` Set the URL.
`void` `setUrl(URL url)` Set the URL.
`void` `setValid(boolean valid)` Valid means that it follows the official guidelines that the siteMapURL must be under the base url
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### DEFAULT_PRIORITY

    public static final double DEFAULT_PRIORITY

See Also:
  Constant Field Values

### Constructor Detail

#### SiteMapURL

    public SiteMapURL(String url,
                      boolean valid)

#### SiteMapURL

    public SiteMapURL(URL url,
                      boolean valid)

#### SiteMapURL

    public SiteMapURL(String url,
                      String lastModified,
                      String changeFreq,
                      String priority,
                      boolean valid)

#### SiteMapURL

    public SiteMapURL(URL url,
                      Date lastModified,
                      SiteMapURL.ChangeFrequency changeFreq,
                      double priority,
                      boolean valid)

### Method Detail

#### getUrl

    public URL getUrl()

Return the URL.

Returns:
  URL

#### setUrl

    public void setUrl(URL url)

Set the URL.

Parameters:
  `url` - of the sitemap

#### setUrl

    public void setUrl(String url)

Set the URL.

Parameters:
  `url` - In case of Malformed URL, the current url in this instance will be set to NULL

#### getLastModified

    public Date getLastModified()

Return when this URL was last modified.

Returns:
  last modified date

#### setLastModified

    public void setLastModified(String lastModified)

Set when this URL was last modified.

Parameters:
  `lastModified` - the last time the sitemap was modified

#### setLastModified

    public void setLastModified(Date lastModified)

Set when this URL was last modified.

Parameters:
  `lastModified` - the last time the sitemap was modified

#### getPriority

    public double getPriority()

Return this URL's priority (a value between [0.0 - 1.0]).

Returns:
  URL's priority (a value between [0.0 - 1.0])

#### setPriority

    public void setPriority(double priority)

Set the URL's priority to a value between [0.0 - 1.0] (Default Priority is used if the given priority is out of range).

Parameters:
  `priority` - a value between [0.0 - 1.0]

#### setPriority

    public void setPriority(String priorityStr)

Set the URL's priority to a value between [0.0 - 1.0] (Default Priority is used if the given priority missing or is out of range).

Parameters:
  `priorityStr` - a value between [0.0 - 1.0]

#### getChangeFrequency

    public SiteMapURL.ChangeFrequency getChangeFrequency()

Return the URL's change frequency

Returns:
  the URL's change frequency

#### setChangeFrequency

    public void setChangeFrequency(SiteMapURL.ChangeFrequency changeFreq)

Set the URL's change frequency

Parameters:
  `changeFreq` - a `SiteMapURL.ChangeFrequency` for this sitemap

#### setChangeFrequency

    public void setChangeFrequency(String changeFreq)

Set the URL's change frequency In case of a bad ChangeFrequency, the current frequency in this instance will be set to NULL

Parameters:
  `changeFreq` - a string representing a `SiteMapURL.ChangeFrequency` for this sitemap

#### setValid

    public void setValid(boolean valid)

Valid means that it follows the official guidelines that the siteMapURL must be under the base url

Parameters:
  `valid` - whether the Sitemap is valid syntax or not

#### isValid

    public boolean isValid()

Is the siteMapURL under the base url ?

Returns:
  true if the syntax is valid, false otherwise

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`