org.tinyjee.maven.dim.sources
Class VelocitySourceClassInvocationTool

java.lang.Object
  extended by org.tinyjee.maven.dim.sources.AbstractParametricVelocityTool<VelocitySourceClassInvocationTool>
      extended by org.tinyjee.maven.dim.sources.VelocitySourceClassInvocationTool

@DefaultKey(value="invoker")
public class VelocitySourceClassInvocationTool
extends AbstractParametricVelocityTool<VelocitySourceClassInvocationTool>

Implements a custom velocity tool that can be used to invoke other source classes.

Usage within a template:

 #set ($result = $invoker.clear().put('paramA', 'value').invokeClass('my.package.MyClass'))
 Result: $result.get("key")
 

Author:
Juergen_Kellerer, 2011-10-14

Constructor Summary
VelocitySourceClassInvocationTool()
           
 
Method Summary
 Map<String,Object> invokeClass(String className)
          Invokes the given 'source-class' compatible helper class.
 Class<?> resolveClass(String className)
          Resolves the given 'source-class' providing access to use reflection.
 
Methods inherited from class org.tinyjee.maven.dim.sources.AbstractParametricVelocityTool
clear, get, nextInvocationParameters, put, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VelocitySourceClassInvocationTool

public VelocitySourceClassInvocationTool()
Method Detail

invokeClass

public Map<String,Object> invokeClass(String className)
Invokes the given 'source-class' compatible helper class.

Parameters:
className - the name of the class to invoke.
Returns:
The parameters that were generated by the class.

resolveClass

public Class<?> resolveClass(String className)
Resolves the given 'source-class' providing access to use reflection.

Parameters:
className - the name of the class to resolve.
Returns:
The Class instance the resolved.