org.apache.tools.ant.taskdefs
Class MacroInstance

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--org.apache.tools.ant.taskdefs.MacroInstance
All Implemented Interfaces:
DynamicConfigurator

public class MacroInstance
extends Task
implements DynamicConfigurator

The class to be placed in the ant type definition. It is given a pointer to the template definition, and makes a copy of the unknown element, substituting the parameter values in attributes and text.

Since:
Ant 1.6
Author:
Peter Reilly

Nested Class Summary
static class MacroInstance.Element
          Embedded element in macro instance
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
MacroInstance()
           
 
Method Summary
 void addText(java.lang.String text)
          Set the text contents for the macro.
 java.lang.Object createDynamicElement(java.lang.String name)
          Add an element.
 void execute()
          Execute the templates instance.
 void setDynamicAttribute(java.lang.String name, java.lang.String value)
          A parameter name value pair as a xml attribute.
 void setMacroDef(MacroDef macroDef)
          Called from MacroDef.MyAntTypeDefinition#create()
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MacroInstance

public MacroInstance()
Method Detail

setMacroDef

public void setMacroDef(MacroDef macroDef)
Called from MacroDef.MyAntTypeDefinition#create()

Parameters:
macroDef - a MacroDef value

setDynamicAttribute

public void setDynamicAttribute(java.lang.String name,
                                java.lang.String value)
A parameter name value pair as a xml attribute.

Specified by:
setDynamicAttribute in interface DynamicConfigurator
Parameters:
name - the name of the attribute
value - the value of the attribute

createDynamicElement

public java.lang.Object createDynamicElement(java.lang.String name)
                                      throws BuildException
Add an element.

Specified by:
createDynamicElement in interface DynamicConfigurator
Parameters:
name - the name of the element
Returns:
an inner Element type
Throws:
BuildException - if the name is not known or if this element has already been seen

addText

public void addText(java.lang.String text)
Set the text contents for the macro.

Parameters:
text - the text to be added to the macro.

execute

public void execute()
Execute the templates instance. Copies the unknown element, substitutes the attributes, and calls perform on the unknown element.

Overrides:
execute in class Task


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.