org.sitemesh.builder
Class BaseSiteMeshBuilder<BUILDER extends BaseSiteMeshBuilder,CONTEXT extends SiteMeshContext,RESULT>

java.lang.Object
  extended by org.sitemesh.builder.BaseSiteMeshBuilder<BUILDER,CONTEXT,RESULT>
Type Parameters:
BUILDER - The type to return from the builder methods. Subclasses should type this as their own class type.
CONTEXT - The type of SiteMesh context used.
RESULT - The resulting type built by the builder.
Direct Known Subclasses:
BaseSiteMeshFilterBuilder, BaseSiteMeshOfflineBuilder

public abstract class BaseSiteMeshBuilder<BUILDER extends BaseSiteMeshBuilder,CONTEXT extends SiteMeshContext,RESULT>
extends Object

Common functionality for BaseSiteMeshFilterBuilder and BaseSiteMeshOfflineBuilder.

Author:
Joe Walnes
See Also:
BaseSiteMeshFilterBuilder, BaseSiteMeshOfflineBuilder

Constructor Summary
protected BaseSiteMeshBuilder()
           
 
Method Summary
 BUILDER addDecoratorPath(String contentPath, String decoratorPath)
          Add a decorator path to be used for a specific content path.
 BUILDER addDecoratorPaths(String contentPath, List<String> decoratorPaths)
          Add multiple decorator paths to be used for a specific content path.
 BUILDER addDecoratorPaths(String contentPath, String... decoratorPaths)
          Add multiple decorator paths to be used for a specific content path.
 BUILDER addTagRuleBundle(TagRuleBundle bundle)
          Add a new TagRuleBundle to the TagBasedContentProcessor.
 BUILDER addTagRuleBundles(Iterable<TagRuleBundle> bundles)
          Convenient way to call addTagRuleBundle(org.sitemesh.content.tagrules.TagRuleBundle) multiple times.
 BUILDER addTagRuleBundles(TagRuleBundle... bundles)
          Convenient way to call addTagRuleBundle(org.sitemesh.content.tagrules.TagRuleBundle) multiple times.
 BUILDER clearTagRuleBundles()
          Clear any TagRuleBundles (including those added in setupDefaults().
abstract  RESULT create()
           
 ContentProcessor getContentProcessor()
          Get configured ContentProcessor.
 DecoratorSelector<CONTEXT> getDecoratorSelector()
          Get configured DecoratorSelector.
protected  BUILDER self()
           
 BUILDER setCustomContentProcessor(ContentProcessor contentProcessor)
          Set the ContentProcessor.
 BUILDER setCustomDecoratorSelector(DecoratorSelector<CONTEXT> decoratorSelector)
          Set a custom DecoratorSelector.
 BUILDER setTagRuleBundles(Iterable<TagRuleBundle> bundles)
          Set the TagRuleBundles.
 BUILDER setTagRuleBundles(TagRuleBundle... bundles)
          Set the TagRuleBundles.
protected  void setupDefaults()
          Setup default settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSiteMeshBuilder

protected BaseSiteMeshBuilder()
Method Detail

create

public abstract RESULT create()
                       throws IllegalStateException
Throws:
IllegalStateException

setupDefaults

protected void setupDefaults()
Setup default settings. Subclasses can override this to add more settings. Defaults to setting the ContentProcessor to TagBasedContentProcessor with CoreHtmlTagRuleBundle and DecoratorTagRuleBundle (the typical setup).


self

protected BUILDER self()

addTagRuleBundle

public BUILDER addTagRuleBundle(TagRuleBundle bundle)
Add a new TagRuleBundle to the TagBasedContentProcessor.

This will always append to the existing list of TagRuleBundles, created in setupDefaults(). To remove these defaults, use clearTagRuleBundles() or setTagRuleBundles(TagRuleBundle[]).

Note: If setCustomContentProcessor(ContentProcessor) is called, any TagRuleBundles are ignored, as they are only used by the default ContentProcessor implementation.


addTagRuleBundles

public BUILDER addTagRuleBundles(TagRuleBundle... bundles)
Convenient way to call addTagRuleBundle(org.sitemesh.content.tagrules.TagRuleBundle) multiple times.

This will always append to the existing list of TagRuleBundles, created in setupDefaults(). To remove these defaults, use clearTagRuleBundles() or setTagRuleBundles(TagRuleBundle[]).

Note: If setCustomContentProcessor(ContentProcessor) is called, any TagRuleBundles are ignored, as they are only used by the default ContentProcessor implementation.


addTagRuleBundles

public BUILDER addTagRuleBundles(Iterable<TagRuleBundle> bundles)
Convenient way to call addTagRuleBundle(org.sitemesh.content.tagrules.TagRuleBundle) multiple times.

This will always append to the existing list of TagRuleBundles, created in setupDefaults(). To remove these defaults, use clearTagRuleBundles() or setTagRuleBundles(TagRuleBundle[]).

Note: If setCustomContentProcessor(ContentProcessor) is called, any TagRuleBundles are ignored, as they are only used by the default ContentProcessor implementation.


clearTagRuleBundles

public BUILDER clearTagRuleBundles()
Clear any TagRuleBundles (including those added in setupDefaults().


setTagRuleBundles

public BUILDER setTagRuleBundles(TagRuleBundle... bundles)
Set the TagRuleBundles. This is the equivalent of calling clearTagRuleBundles() followed by addTagRuleBundles(TagRuleBundle[]).

Note: If setCustomContentProcessor(ContentProcessor) is called, any TagRuleBundles are ignored, as they are only used by the default ContentProcessor implementation.


setTagRuleBundles

public BUILDER setTagRuleBundles(Iterable<TagRuleBundle> bundles)
Set the TagRuleBundles. This is the equivalent of calling clearTagRuleBundles() followed by #addTagRuleBundles(Iterable).

Note: If setCustomContentProcessor(ContentProcessor) is called, any TagRuleBundles are ignored, as they are only used by the default ContentProcessor implementation.


setCustomContentProcessor

public BUILDER setCustomContentProcessor(ContentProcessor contentProcessor)
Set the ContentProcessor. If called, this will override any calls to addTagRuleBundle(TagRuleBundle).


getContentProcessor

public ContentProcessor getContentProcessor()
Get configured ContentProcessor.


addDecoratorPaths

public BUILDER addDecoratorPaths(String contentPath,
                                 String... decoratorPaths)
Add multiple decorator paths to be used for a specific content path. Use this to apply multiple decorators to a single page.

Note: If setCustomDecoratorSelector(DecoratorSelector) is called, any decorator paths are ignored, as they are only used by the default DecoratorSelector implementation.


addDecoratorPaths

public BUILDER addDecoratorPaths(String contentPath,
                                 List<String> decoratorPaths)
Add multiple decorator paths to be used for a specific content path. Use this to apply multiple decorators to a single page.

Note: If setCustomDecoratorSelector(DecoratorSelector) is called, any decorator paths are ignored, as they are only used by the default DecoratorSelector implementation.


addDecoratorPath

public BUILDER addDecoratorPath(String contentPath,
                                String decoratorPath)
Add a decorator path to be used for a specific content path.

Note: If setCustomDecoratorSelector(DecoratorSelector) is called, any decorator paths are ignored, as they are only used by the default DecoratorSelector implementation.


setCustomDecoratorSelector

public BUILDER setCustomDecoratorSelector(DecoratorSelector<CONTEXT> decoratorSelector)
Set a custom DecoratorSelector. If called, this will override any paths added with addDecoratorPath(String, String) and instead delegate to the custom DecoratorSelector.


getDecoratorSelector

public DecoratorSelector<CONTEXT> getDecoratorSelector()
Get configured DecoratorSelector.



Copyright © 2011. All Rights Reserved.