org.sitemesh.builder
Class SiteMeshOfflineBuilder
java.lang.Object
org.sitemesh.builder.BaseSiteMeshBuilder<BUILDER,OfflineContext,SiteMeshOffline>
org.sitemesh.builder.BaseSiteMeshOfflineBuilder<SiteMeshOfflineBuilder>
org.sitemesh.builder.SiteMeshOfflineBuilder
public final class SiteMeshOfflineBuilder
- extends BaseSiteMeshOfflineBuilder<SiteMeshOfflineBuilder>
Convenient API for building the a SiteMeshOffline.
This follows the API builder pattern - each method returns a reference to the original builder
so they can be chained together. When configured, call the create() method which will
return the final immutable SiteMeshOffline.
At the very least, sourceDirectory and destinationDirectory must be set before
calling create(), otherwise an IllegalStateException will be thrown.
Examples
// Simplest example...
SiteMeshOffline siteMeshOffline = new SiteMeshOfflineBuilder()
.setDirectory("src/html")
.setDestinationDirectory("dest/html")
.addDecoratorPath("/*", "/decorator.html")
.create();
// A few more options (shows applying multiple decorators to a single page)...
SiteMeshOffline siteMeshOffline = new SiteMeshOfflineBuilder()
.setDirectory(new File("src/html"))
.setDestinationDirectory(new File("dest/html"))
.addDecoratorPaths("/*", "/decorators/main-layout.html", "/decorators-common-style.html")
.addDecoratorPaths("/admin/*", "/decorators/admin-layout.html", "/decorators-common-style.html")
.addTagRuleBundle(new MyLinkRewriterBundle())
.create();
// If you want to get a bit crazy and totally customize SiteMesh...
SiteMeshOffline siteMeshOffline = new SiteMeshOfflineBuilder()
.setDirectory(new MyDirectoryThatLoadsFromDatabase())
.setDestinationDirectory(new InMemoryDirectory())
.setCustomContentProcessor(new MySvgContentProcessor())
.setCustomDecoratorSelector(new MyDatabaseDrivenDecoratorSelector())
.create();
Custom implementations (advanced)
This is only for advanced users who need to change the behavior of the builder...
If you ever find the need to subclass SiteMeshOfflineBuilder (e.g. to add more convenience
methods, to change the implementation returned, or add new functionality), it is instead recommended
that you extends BaseSiteMeshOfflineBuilder. This way, the generic type signature can
be altered.
- Author:
- Joe Walnes
| Methods inherited from class org.sitemesh.builder.BaseSiteMeshBuilder |
addDecoratorPath, addDecoratorPaths, addDecoratorPaths, addTagRuleBundle, addTagRuleBundles, addTagRuleBundles, clearTagRuleBundles, getContentProcessor, getDecoratorSelector, self, setCustomContentProcessor, setCustomDecoratorSelector, setTagRuleBundles, setTagRuleBundles, setupDefaults |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SiteMeshOfflineBuilder
public SiteMeshOfflineBuilder()
create
public SiteMeshOffline create()
throws IllegalStateException
- Create the SiteMeshOfflineGenerator.
- Specified by:
create in class BaseSiteMeshOfflineBuilder<SiteMeshOfflineBuilder>
- Throws:
IllegalStateException - unless both the source and destionation
directories have been set.
Copyright © 2011. All Rights Reserved.