net.ggtools.grand.ant
Class ReflectTaskVisitorBase

java.lang.Object
  extended by net.ggtools.grand.ant.ReflectTaskVisitorBase
All Implemented Interfaces:
TaskVisitor
Direct Known Subclasses:
LinkFinderVisitor

abstract class ReflectTaskVisitorBase
extends java.lang.Object
implements TaskVisitor

A base class using reflectivity in order to invoke a method depending on the visited wrapper.

Author:
Christophe Labouisse

Constructor Summary
ReflectTaskVisitorBase()
           
 
Method Summary
abstract  void defaultVisit(org.apache.tools.ant.RuntimeConfigurable wrapper)
           
 java.lang.String getAliasForTask(java.lang.String taskName)
          A default implementation returning the task name.
 void visit(org.apache.tools.ant.RuntimeConfigurable wrapper)
          Invoke the right method depending on the wrapper's element tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectTaskVisitorBase

ReflectTaskVisitorBase()
Method Detail

visit

public void visit(org.apache.tools.ant.RuntimeConfigurable wrapper)
           throws GrandException
Invoke the right method depending on the wrapper's element tag. The algorithm is:
  1. get the wrapper's element tag name,
  2. if the cache already contain a method, use it,
  3. call getAliasForTask(String)to find out if there is an alias for this task,
  4. try to get the method called reflectVisit_task_name,
  5. call the found method.
If the following algorithm fails then we'll use the defaultVisit(RuntimeConfigurable)fallback method.

Specified by:
visit in interface TaskVisitor
Parameters:
wrapper - Wrapper to visit.
Throws:
GrandException - if something goes wrong.
See Also:
TaskVisitor.visit(org.apache.tools.ant.RuntimeConfigurable)

defaultVisit

public abstract void defaultVisit(org.apache.tools.ant.RuntimeConfigurable wrapper)
                           throws GrandException
Throws:
GrandException

getAliasForTask

public java.lang.String getAliasForTask(java.lang.String taskName)
A default implementation returning the task name.

Parameters:
taskName -
Returns:
the name to use when look for the method to invoke. Should not be null.


Copyright © 2004-2005 ggTools. All Rights Reserved.