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

  • Type Parameters:
    G -


    public class SitemapGeneratorBuilder<G extends com.redfin.sitemapgenerator.SitemapGenerator<?,?>>
    extends 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()

    • Constructor Summary

      Constructors

      Constructor and Description
      SitemapGeneratorBuilder(String baseUrl, File baseDir, Class<G> sitemapGeneratorClass)
      Configures the generator with a base URL and directory to write the sitemap files.
      SitemapGeneratorBuilder(URL baseUrl, File baseDir, Class<G> sitemapGeneratorClass)
      Configures the generator with a base URL and directory to write the sitemap files.
    • Method Summary

      Modifier and Type Method and Description
      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(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)
      THIS suffixStringPattern(String pattern)
       
    • Constructor Detail

      • SitemapGeneratorBuilder

        public SitemapGeneratorBuilder(URL baseUrl,
                                       File baseDir,
                                       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(String baseUrl,
                                       File baseDir,
                                       Class<G> sitemapGeneratorClass)
                                throws 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:
        MalformedURLException
    • Method Detail

      • build

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

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

        public THIS suffixStringPattern(String pattern)
      • 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?
      • 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