public final class SiteMeshOfflineBuilder extends BaseSiteMeshOfflineBuilder<SiteMeshOfflineBuilder>
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.
// 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();
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.
Constructor and Description |
---|
SiteMeshOfflineBuilder() |
Modifier and Type | Method and Description |
---|---|
SiteMeshOffline |
create()
Create the SiteMeshOfflineGenerator.
|
getDestinationDirectory, getSourceDirectory, setDestinationDirectory, setDestinationDirectory, setDestinationDirectory, setSourceDirectory, setSourceDirectory, setSourceDirectory
addDecoratorPath, addDecoratorPaths, addDecoratorPaths, addTagRuleBundle, addTagRuleBundles, addTagRuleBundles, clearTagRuleBundles, getContentProcessor, getDecoratorSelector, self, setCustomContentProcessor, setCustomDecoratorSelector, setTagRuleBundles, setTagRuleBundles, setupDefaults
public SiteMeshOffline create() throws IllegalStateException
create
in class BaseSiteMeshOfflineBuilder<SiteMeshOfflineBuilder>
IllegalStateException
- unless both the source and destionation
directories have been set.Copyright © 2015. All Rights Reserved.