org.springframework.beandoc.output
Class SimpleDecorator

java.lang.Object
  extended by org.springframework.beandoc.output.SimpleDecorator
All Implemented Interfaces:
Decorator
Direct Known Subclasses:
CsvDecorator, GraphVizDecorator, HtmlDecorator, JavaDocDecorator

public abstract class SimpleDecorator
extends Object
implements Decorator

Abstract implementation of the Decorator interface which simply iterates each Element in each Document and calls the protected decorateElement method that subclasses will implement.

The Elements selected for iteration can be modified from the default (all Elements in the DOM) by specifying a Filter based on Element names.

Since:
1.0
Author:
Darren Davison

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
SimpleDecorator()
           
 
Method Summary
 void decorate(org.jdom.Document[] contextDocuments)
          Permits decoration of the document by iterating all the filtered child elements in the Documents supplied and calls a decorateElement() for each one.
protected abstract  void decorateElement(org.jdom.Element element)
          Each Element in each input Document is iteratively passed to this method allowing subclasses to add or amend any attributes they desire.
 void setFilter(org.jdom.filter.ElementFilter elementFilter)
          Directly specify a Filter to limit the Elements from the DOM that this instance will iterate over when permitting decoration.
 void setFilterNames(String[] tagNames)
          Specify an array of tag names that define Elements this instance will iterate over.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

SimpleDecorator

public SimpleDecorator()
Method Detail

decorate

public void decorate(org.jdom.Document[] contextDocuments)
Permits decoration of the document by iterating all the filtered child elements in the Documents supplied and calls a decorateElement() for each one. decorateElement() must be implemented by subclasses.

By default, all Elements in the DOM are iterated. To filter the list to specific named Elements, use setFilterNames() or setFilter()

Specified by:
decorate in interface Decorator
Parameters:
contextDocuments - an array of Document objects representing the in-memory tree of the input files supplied to the beandoc ContextProcessor.
See Also:
Decorator.decorate(org.jdom.Document[]), setFilterNames(java.lang.String[]), setFilter(org.jdom.filter.ElementFilter)

decorateElement

protected abstract void decorateElement(org.jdom.Element element)
Each Element in each input Document is iteratively passed to this method allowing subclasses to add or amend any attributes they desire. It's possible to filter the view of the DOM, and thereby the list of Elements that will be passed to this method by setting a Filter on this instance.

Parameters:
element -
See Also:
setFilterNames(java.lang.String[]), setFilter(org.jdom.filter.ElementFilter)

setFilter

public void setFilter(org.jdom.filter.ElementFilter elementFilter)
Directly specify a Filter to limit the Elements from the DOM that this instance will iterate over when permitting decoration.

Parameters:
elementFilter -

setFilterNames

public void setFilterNames(String[] tagNames)
Specify an array of tag names that define Elements this instance will iterate over. If your subclass need only be concerned with <bean> and <property> tags for example, you can set those two names as elements of the array of names and only these Element types will be passed into the decorateElement method.

Parameters:
tagNames -


Copyright © 2004-2009 Spring BeanDoc. All Rights Reserved.