org.springframework.beandoc.output
Class JavaDocDecorator

java.lang.Object
  extended by org.springframework.beandoc.output.SimpleDecorator
      extended by org.springframework.beandoc.output.JavaDocDecorator
All Implemented Interfaces:
Decorator

public class JavaDocDecorator
extends SimpleDecorator

Decorator implementation that adds JavaDoc href's to beans based on their classes. The Decorator knows about standard Java library class locations, and additional locations can be added based on a simple pattern matching strategy for the class name.

Since:
1.0
Author:
Darren Davison

Field Summary
protected static String ATTRIBUTE_JAVADOC
           
 
Fields inherited from class org.springframework.beandoc.output.SimpleDecorator
logger
 
Constructor Summary
JavaDocDecorator()
          Default constructor adds well know locations to the JavaDoc location Map which can be used by a Transformer.
 
Method Summary
 void addLocation(String classPrefix, String url)
          Add a JavaDoc location used in the output documents to link classnames to their JavaDoc pages.
protected  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.
 SortedMap getLocations()
          A SortedMap keyed by package prefixes that point to URI's (local, remote, absolute or relative) of JavaDoc locations.
 void setLocations(SortedMap map)
          A SortedMap keyed by package prefixes that point to URI's (local, remote, absolute or relative) of JavaDoc locations.
 
Methods inherited from class org.springframework.beandoc.output.SimpleDecorator
decorate, setFilter, setFilterNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_JAVADOC

protected static final String ATTRIBUTE_JAVADOC
See Also:
Constant Field Values
Constructor Detail

JavaDocDecorator

public JavaDocDecorator()
Default constructor adds well know locations to the JavaDoc location Map which can be used by a Transformer.

Method Detail

decorateElement

protected void decorateElement(org.jdom.Element element)
Description copied from class: SimpleDecorator
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.

Specified by:
decorateElement in class SimpleDecorator
See Also:
SimpleDecorator.decorateElement(org.jdom.Element)

setLocations

public void setLocations(SortedMap map)
A SortedMap keyed by package prefixes that point to URI's (local, remote, absolute or relative) of JavaDoc locations. Used to link classnames to their javadoc locations in the HTML output. The preferred way to modify this list programmatically is through the addLocation(java.lang.String, java.lang.String) convenience method.

Parameters:
map - a SortedMap of javadoc locations keyed by package name prefixes.
See Also:
addLocation(String, String)

addLocation

public void addLocation(String classPrefix,
                        String url)
Add a JavaDoc location used in the output documents to link classnames to their JavaDoc pages. Specify a package prefix followed by a URL. Classes whose package names start with that prefix (using String.startsWith()) will be linked to this location.

For example, adding a location where

    classPrefix = com.foo.bar.
    url = http://our.server.com/doc/api/
 
will cause a class in this package named Example.class to be linked with an HREF of; http://our.server.com/doc/api/com/foo/bar/Example.html

Note that the package names are used as keys in a SortedMap which is sorted in reverse order by key length. This means you can add package keys in any order you like, and class names will be evaluated against the longest package names first down to the shortest. This enables you for example to specify that org.springframework.samples. has a different document location than org.springframework.

Parameters:
classPrefix - the prefix, of arbitrary length, of the package and class name to match against. May not be null (will be ignored)
url - the root of the API documentation

getLocations

public SortedMap getLocations()
A SortedMap keyed by package prefixes that point to URI's (local, remote, absolute or relative) of JavaDoc locations. Used to link classnames to their javadoc locations in the HTML output.

The returned underlying SortedMap is modifiable and will, if modified, affect subsequent calls to the BeanDocEngine's process() method if you are using the tool programmatically. The preferred way to modify this list is through the addLocation(java.lang.String, java.lang.String) convenience method.

Returns:
a SortedMap of javadoc locations keyed by package name prefixes.
See Also:
addLocation(java.lang.String, java.lang.String)


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