org.tinyjee.maven.dim.sources
Class SourceClassAdapter

java.lang.Object
  extended by org.tinyjee.maven.dim.spi.AbstractSource
      extended by org.tinyjee.maven.dim.sources.AbstractBufferedSource
          extended by org.tinyjee.maven.dim.sources.SourceClassAdapter
All Implemented Interfaces:
Source

public class SourceClassAdapter
extends AbstractBufferedSource

Adapts a source class to the source interface.

Version:
1.0
Author:
Juergen_Kellerer, 2010-09-04

Nested Class Summary
 
Nested classes/interfaces inherited from class org.tinyjee.maven.dim.sources.AbstractBufferedSource
AbstractBufferedSource.BufferedSourceContent
 
Nested classes/interfaces inherited from class org.tinyjee.maven.dim.spi.AbstractSource
AbstractSource.SourceContent
 
Nested classes/interfaces inherited from interface org.tinyjee.maven.dim.spi.Source
Source.Content
 
Field Summary
static String LEGACY_CONTENT_MAP_KEY
          Defines the map key to use for retrieving the source content from the Map defined with the wrapped class.
 
Fields inherited from class org.tinyjee.maven.dim.sources.AbstractBufferedSource
content
 
Fields inherited from class org.tinyjee.maven.dim.spi.AbstractSource
parameters, sourceUrl
 
Constructor Summary
SourceClassAdapter(File basePath, Map requestParams, String className)
          Creates a new instance of SourceClassAdapter.
 
Method Summary
 Source.Content getContent()
          Retrieves the source content.
protected  void writeSourceContent(Writer writer)
          Is called when the source content has to be created.
 
Methods inherited from class org.tinyjee.maven.dim.sources.AbstractBufferedSource
reset
 
Methods inherited from class org.tinyjee.maven.dim.spi.AbstractSource
getUrl, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEGACY_CONTENT_MAP_KEY

public static final String LEGACY_CONTENT_MAP_KEY
Defines the map key to use for retrieving the source content from the Map defined with the wrapped class.

Note: A source class can decide to return an instance of Map<Integer, List<String>> when queried for the key defined by this constant.

See Also:
Constant Field Values
Constructor Detail

SourceClassAdapter

public SourceClassAdapter(File basePath,
                          Map requestParams,
                          String className)
Creates a new instance of SourceClassAdapter.

Parameters:
basePath - the base path containing the "target/classes" folder.
requestParams - the params of the macro request (are optionally passed to the object instance).
className - the name of the class to adapt.
Method Detail

getContent

public Source.Content getContent()
Description copied from interface: Source
Retrieves the source content.

Specified by:
getContent in interface Source
Overrides:
getContent in class AbstractBufferedSource
Returns:
the source content.

writeSourceContent

protected void writeSourceContent(Writer writer)
                           throws IOException
Description copied from class: AbstractBufferedSource
Is called when the source content has to be created.

Specified by:
writeSourceContent in class AbstractBufferedSource
Parameters:
writer - the writer to write the source content to.
Throws:
IOException - in case of writing failed.