com.redfin.sitemapgenerator
Class SitemapGeneratorBuilder<G extends com.redfin.sitemapgenerator.SitemapGenerator<?,?>>

java.lang.Object
  extended by com.redfin.sitemapgenerator.SitemapGeneratorBuilder<G>
Type Parameters:
G -

public class SitemapGeneratorBuilder<G extends com.redfin.sitemapgenerator.SitemapGenerator<?,?>>
extends java.lang.Object

A convenience class to let you configure options straightforwardly; don't instantiate by hand.

Instead, get one statically from a SitemapGenerator class. For example: WebSitemapGenerator g =
WebSitemapGenerator.builder("http://example.com", myDir).gzip(true).autoValidate(true).build()

Author:
Dan Fabulich

Constructor Summary
SitemapGeneratorBuilder(java.lang.String baseUrl, java.io.File baseDir, java.lang.Class<G> sitemapGeneratorClass)
          Configures the generator with a base URL and directory to write the sitemap files.
SitemapGeneratorBuilder(java.net.URL baseUrl, java.io.File baseDir, java.lang.Class<G> sitemapGeneratorClass)
          Configures the generator with a base URL and directory to write the sitemap files.
 
Method Summary
 THIS allowMultipleSitemaps(boolean allowMultipleSitemaps)
          When more than the maximum number of URLs are passed in, should we split into multiple sitemaps automatically, or just throw an exception?
 THIS autoValidate(boolean autoValidate)
          Validate the sitemaps automatically after writing them; this takes time (and may fail for Google-specific sitemaps)
 G build()
          Constructs a sitemap generator configured with the options you specified
 THIS dateFormat(W3CDateFormat dateFormat)
          The date formatter, typically configured with a W3CDateFormat.Pattern and/or a time zone
 THIS fileNamePrefix(java.lang.String fileNamePrefix)
          The prefix of the name of the sitemaps we'll create; by default this is "sitemap"
 THIS gzip(boolean gzip)
          Gzip the sitemaps after they are written to disk
 THIS maxUrls(int maxUrls)
          The maximum number of URLs to allow per sitemap; the default is the maximum allowed (50,000), but you can decrease it if you wish (to make your auto-generated sitemaps smaller)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SitemapGeneratorBuilder

public SitemapGeneratorBuilder(java.net.URL baseUrl,
                               java.io.File baseDir,
                               java.lang.Class<G> sitemapGeneratorClass)
Configures the generator with a base URL and directory to write the sitemap files.

Parameters:
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
baseDir - Sitemap files will be generated in this directory as either "sitemap.xml" or "sitemap1.xml" "sitemap2.xml" and so on.
sitemapGeneratorClass - the class of the generator the builder will create

SitemapGeneratorBuilder

public SitemapGeneratorBuilder(java.lang.String baseUrl,
                               java.io.File baseDir,
                               java.lang.Class<G> sitemapGeneratorClass)
                        throws java.net.MalformedURLException
Configures the generator with a base URL and directory to write the sitemap files.

Parameters:
baseUrl - All URLs in the generated sitemap(s) should appear under this base URL
baseDir - Sitemap files will be generated in this directory as either "sitemap.xml" or "sitemap1.xml" "sitemap2.xml" and so on.
sitemapGeneratorClass - the class of the generator the builder will create
Throws:
java.net.MalformedURLException
Method Detail

build

public G build()
Constructs a sitemap generator configured with the options you specified


fileNamePrefix

public THIS fileNamePrefix(java.lang.String fileNamePrefix)
The prefix of the name of the sitemaps we'll create; by default this is "sitemap"


allowMultipleSitemaps

public THIS allowMultipleSitemaps(boolean allowMultipleSitemaps)
When more than the maximum number of URLs are passed in, should we split into multiple sitemaps automatically, or just throw an exception?


dateFormat

public THIS dateFormat(W3CDateFormat dateFormat)
The date formatter, typically configured with a W3CDateFormat.Pattern and/or a time zone


maxUrls

public THIS maxUrls(int maxUrls)
The maximum number of URLs to allow per sitemap; the default is the maximum allowed (50,000), but you can decrease it if you wish (to make your auto-generated sitemaps smaller)


autoValidate

public THIS autoValidate(boolean autoValidate)
Validate the sitemaps automatically after writing them; this takes time (and may fail for Google-specific sitemaps)


gzip

public THIS gzip(boolean gzip)
Gzip the sitemaps after they are written to disk



Copyright © 2009. All Rights Reserved.