Class AbstractGenerator<I extends AbstractGenerator>

  • Type Parameters:
    I - Concrete implementation of AbstractGenerator, for example SitemapGenerator
    Direct Known Subclasses:
    AbstractSitemapGenerator, RssGenerator

    public abstract class AbstractGenerator<I extends AbstractGenerator>
    extends Object
    Abstract Generator
    • Constructor Detail

      • AbstractGenerator

        public AbstractGenerator​(String baseUrl,
                                 boolean root)
        Construct web sitemap.
        Parameters:
        baseUrl - All URLs must start with this baseUrl, for example http://www.javavids.com
        root - If Base URL is root (for example http://www.javavids.com or if it's some path like http://www.javalibs.com/blog)
      • AbstractGenerator

        public AbstractGenerator​(String baseUrl)
        Construct web sitemap. Root = true.
        Parameters:
        baseUrl - All URLs must start with this baseUrl, for example http://www.javavids.com
    • Method Detail

      • addPage

        public I addPage​(WebPage webPage)
        Add single page to sitemap
        Parameters:
        webPage - single page
        Returns:
        this
      • beforeAddPageEvent

        protected void beforeAddPageEvent​(WebPage webPage)
        This method is called before adding a page to urls. It can be used to change webPage attributes
        Parameters:
        webPage - WebPage
      • addPages

        public I addPages​(Collection<WebPage> webPages)
        Add collection of pages to sitemap
        Parameters:
        webPages - Collection of pages
        Returns:
        this
      • addPages

        public <T> I addPages​(Collection<T> webPages,
                              java.util.function.Function<T,​WebPage> mapper)
        Add collection of pages to sitemap
        Type Parameters:
        T - This is the type parameter
        Parameters:
        webPages - Collection of pages
        mapper - Mapper function which transforms some object to WebPage
        Returns:
        this
      • addPages

        public <T> I addPages​(java.util.function.Supplier<Collection<T>> webPagesSupplier,
                              java.util.function.Function<T,​WebPage> mapper)
        Add collection of pages to sitemap
        Type Parameters:
        T - This is the type parameter
        Parameters:
        webPagesSupplier - Collection of pages supplier
        mapper - Mapper function which transforms some object to WebPage
        Returns:
        this
      • getThis

        protected I getThis()