Class MacroInstance

  • All Implemented Interfaces:
    java.lang.Cloneable, DynamicAttribute, TaskContainer

    public class MacroInstance
    extends Task
    implements DynamicAttribute, TaskContainer
    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
    • Constructor Detail

      • MacroInstance

        public MacroInstance()
    • Method Detail

      • setMacroDef

        public void setMacroDef​(MacroDef macroDef)
        Called from MacroDef.MyAntTypeDefinition#create()
        Parameters:
        macroDef - a MacroDef value
      • getMacroDef

        public MacroDef getMacroDef()
        Returns:
        the macro definition object for this macro instance.
      • 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 DynamicAttribute
        Parameters:
        name - the name of the attribute
        value - the value of the attribute
      • createDynamicElement

        @Deprecated
        public java.lang.Object createDynamicElement​(java.lang.String name)
                                              throws BuildException
        Deprecated.
        since 1.6.x.
        Method present for BC purposes.
        Parameters:
        name - not used
        Returns:
        nothing
        Throws:
        BuildException - always
      • addTask

        public void addTask​(Task nestedTask)
        Add a unknownElement for the macro instances nested elements.
        Specified by:
        addTask in interface TaskContainer
        Parameters:
        nestedTask - a nested element.
      • 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