Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class MacroDef

extends AntlibDefinition
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .List, .Locale, .Map, .Objects, org.apache.tools.ant.AntTypeDefinition, .BuildException, .ComponentHelper, .Project, .ProjectHelper, .RuntimeConfigurable, .Task, .TaskContainer, .UnknownElement

Describe class MacroDef here.
Since
Ant 1.6

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MacroDef.Attribute

An attribute for the MacroDef task.

private static class
MacroDef.MyAntTypeDefinition

extends AntTypeDefinition, on create of the object, the template macro definition is given.

public static class
MacroDef.NestedSequential

The class corresponding to the sequential nested element.

public static class
MacroDef.TemplateElement

A nested element for the MacroDef task.

public static class
MacroDef.Text

A nested text element for the MacroDef task.

Field Summary

Modifier and TypeField and Description
private List<MacroDef.Attribute>
private boolean
private Map<String, MacroDef.TemplateElement>
private boolean
private String
private MacroDef.NestedSequential
private MacroDef.Text
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addConfiguredAttribute(MacroDef.Attribute
an attribute nested element.
attribute
)

Add an attribute element.

public void
addConfiguredElement(MacroDef.TemplateElement
an element nested element.
element
)

Add an element element.

public void
addConfiguredText(MacroDef.Text
the nested text element to add
text
)

Add the text element.

public MacroDef.NestedSequential

Returns:

a sequential element to be configured.
createSequential
()

This is the sequential nested element of the macrodef.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Create a new ant type based on the embedded tasks and types.
public List<MacroDef.Attribute>

Returns:

the nested Attributes
getAttributes
()

Gets this macro's attribute (and define?) list.

public boolean

Returns:

the backTrace attribute.
getBackTrace
()

public Map<String, MacroDef.TemplateElement>

Returns:

the map nested elements, keyed by element name, with TemplateElement values.
getElements
()

Gets this macro's elements.

public UnknownElement

Returns:

the nested sequential as an unknown element.
getNestedTask
()

Convert the nested sequential to an unknown element

public MacroDef.Text

Returns:

the nested text element
getText
()

private static boolean

Returns:

true if the name consists of valid name characters
isValidName
(String
the string to check
name
)

Check if a string is a valid name for an element or attribute.

public static boolean

Returns:

true if the character is a letter or digit or '.' or '-' attribute name
isValidNameCharacter
(char
the character to check
c
)

Check if a character is a valid character for an element or attribute name.

public boolean

Returns:

true if the definitions are the same
sameDefinition
(Object
another definition
obj
)

Equality method for this definition

private boolean

Returns:

a boolean value
sameOrSimilar
(Object
an Object value
obj
,
boolean
if true test for sameness, otherwise just similar
same
)

same or similar equality method for macrodef, ignores project and runtime info.

public void
setBackTrace(boolean
if true and the macro instance generates an error, a backtrace of the location within the macro and call to the macro will be output. if false, only the location of the call to the macro will be shown. Default is true.
backTrace
)

Set the backTrace attribute.

public void
setName(String
the name of the definition
name
)

Name of the definition

public boolean

Returns:

true if the definitions are similar
similar
(Object
another definition
obj
)

Similar method for this definition

Inherited from org.apache.tools.ant.taskdefs.AntlibDefinition:
getAntlibClassLoadergetURIsetAntlibClassLoadersetURI

Field Detail

attributesback to summary
private List<MacroDef.Attribute> attributes
backTraceback to summary
private boolean backTrace
elementsback to summary
private Map<String, MacroDef.TemplateElement> elements
hasImplicitElementback to summary
private boolean hasImplicitElement
nameback to summary
private String name
nestedSequentialback to summary
private MacroDef.NestedSequential nestedSequential
textback to summary
private MacroDef.Text text
textNameback to summary
private String textName

Constructor Detail

MacroDefback to summary
public MacroDef()

Method Detail

addConfiguredAttributeback to summary
public void addConfiguredAttribute(MacroDef.Attribute attribute)

Add an attribute element.

Parameters
attribute:MacroDef.Attribute

an attribute nested element.

addConfiguredElementback to summary
public void addConfiguredElement(MacroDef.TemplateElement element)

Add an element element.

Parameters
element:MacroDef.TemplateElement

an element nested element.

addConfiguredTextback to summary
public void addConfiguredText(MacroDef.Text text)

Add the text element.

Parameters
text:MacroDef.Text

the nested text element to add

Since
ant 1.6.1
createSequentialback to summary
public MacroDef.NestedSequential createSequential()

This is the sequential nested element of the macrodef.

Returns:MacroDef.NestedSequential

a sequential element to be configured.

executeback to summary
public void execute()

Overrides org.apache.tools.ant.Task.execute.

Create a new ant type based on the embedded tasks and types.

Annotations
@Override
getAttributesback to summary
public List<MacroDef.Attribute> getAttributes()

Gets this macro's attribute (and define?) list.

Returns:List<MacroDef.Attribute>

the nested Attributes

getBackTraceback to summary
public boolean getBackTrace()
Returns:boolean

the backTrace attribute.

Since
ant 1.7
getElementsback to summary
public Map<String, MacroDef.TemplateElement> getElements()

Gets this macro's elements.

Returns:Map<String, MacroDef.TemplateElement>

the map nested elements, keyed by element name, with TemplateElement values.

getNestedTaskback to summary
public UnknownElement getNestedTask()

Convert the nested sequential to an unknown element

Returns:UnknownElement

the nested sequential as an unknown element.

getTextback to summary
public MacroDef.Text getText()
Returns:MacroDef.Text

the nested text element

Since
ant 1.6.1
isValidNameback to summary
private static boolean isValidName(String name)

Check if a string is a valid name for an element or attribute.

Parameters
name:String

the string to check

Returns:boolean

true if the name consists of valid name characters

isValidNameCharacterback to summary
public static boolean isValidNameCharacter(char c)

Check if a character is a valid character for an element or attribute name.

Parameters
c:char

the character to check

Returns:boolean

true if the character is a letter or digit or '.' or '-' attribute name

sameDefinitionback to summary
public boolean sameDefinition(Object obj)

Equality method for this definition

Parameters
obj:Object

another definition

Returns:boolean

true if the definitions are the same

sameOrSimilarback to summary
private boolean sameOrSimilar(Object obj, boolean same)

same or similar equality method for macrodef, ignores project and runtime info.

Parameters
obj:Object

an Object value

same:boolean

if true test for sameness, otherwise just similar

Returns:boolean

a boolean value

setBackTraceback to summary
public void setBackTrace(boolean backTrace)

Set the backTrace attribute.

Parameters
backTrace:boolean

if true and the macro instance generates an error, a backtrace of the location within the macro and call to the macro will be output. if false, only the location of the call to the macro will be shown. Default is true.

Since
ant 1.7
setNameback to summary
public void setName(String name)

Name of the definition

Parameters
name:String

the name of the definition

similarback to summary
public boolean similar(Object obj)

Similar method for this definition

Parameters
obj:Object

another definition

Returns:boolean

true if the definitions are similar

org.apache.tools.ant.taskdefs back to summary

public Class MacroDef.Attribute

extends Object
Class Inheritance

An attribute for the MacroDef task.

Field Summary

Modifier and TypeField and Description
private String
private String
private boolean
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

a boolean value
equals
(Object
an Object value
obj
)

Overrides java.lang.Object.equals.

equality method
public String

Returns:

the default value, null if not set
getDefault
()

public String

Returns:

the description of the element, or null if no description is available.
getDescription
()

public String

Returns:

the name of the attribute
getName
()

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean

Returns:

true if expanding twice (the default), false for just once
isDoubleExpanding
()

Determines whether RuntimeConfigurable#maybeConfigure(Project, boolean) will reevaluate this property.

public void
setDefault(String
the default value
defaultValue
)

The default value to use if the parameter is not used in the templated instance.

public void
setDescription(String
Description of the element.
desc
)

public void
setDoubleExpanding(boolean
true to expand twice, false for just once
doubleExpanding
)

See isDoubleExpanding for explanation.

public void
setName(String
the name of the attribute
name
)

The name of the attribute.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultValueback to summary
private String defaultValue
descriptionback to summary
private String description
doubleExpandingback to summary
private boolean doubleExpanding
nameback to summary
private String name

Constructor Detail

Attributeback to summary
public Attribute()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

equality method

Parameters
obj:Object

an Object value

Returns:boolean

a boolean value

Annotations
@Override
getDefaultback to summary
public String getDefault()
Returns:String

the default value, null if not set

getDescriptionback to summary
public String getDescription()
Returns:String

the description of the element, or null if no description is available.

Since
ant 1.6.1
getNameback to summary
public String getName()
Returns:String

the name of the attribute

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isDoubleExpandingback to summary
public boolean isDoubleExpanding()

Determines whether RuntimeConfigurable#maybeConfigure(Project, boolean) will reevaluate this property. For compatibility reasons (#52621) it will, though for most applications (#42046) it should not.

Returns:boolean

true if expanding twice (the default), false for just once

Since
Ant 1.8.3
setDefaultback to summary
public void setDefault(String defaultValue)

The default value to use if the parameter is not used in the templated instance.

Parameters
defaultValue:String

the default value

setDescriptionback to summary
public void setDescription(String desc)
Parameters
desc:String

Description of the element.

Since
ant 1.6.1
setDoubleExpandingback to summary
public void setDoubleExpanding(boolean doubleExpanding)

See isDoubleExpanding for explanation.

Parameters
doubleExpanding:boolean

true to expand twice, false for just once

Since
Ant 1.8.3
setNameback to summary
public void setName(String name)

The name of the attribute.

Parameters
name:String

the name of the attribute

org.apache.tools.ant.taskdefs back to summary

private Class MacroDef.MyAntTypeDefinition

extends AntTypeDefinition
Class Inheritance

extends AntTypeDefinition, on create of the object, the template macro definition is given.

Field Summary

Modifier and TypeField and Description
private MacroDef

Constructor Summary

AccessConstructor and Description
public
MyAntTypeDefinition(MacroDef
a MacroDef value
macroDef
)

Creates a new MyAntTypeDefinition instance.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the created object
create
(Project
the current project
project
)

Overrides org.apache.tools.ant.AntTypeDefinition.create.

Create an instance of the definition.
public boolean

Returns:

true if the definitions are the same
sameDefinition
(AntTypeDefinition
another definition
other
,
Project
the current project
project
)

Overrides org.apache.tools.ant.AntTypeDefinition.sameDefinition.

Equality method for this definition
public boolean

Returns:

true if the definitions are the same
similarDefinition
(AntTypeDefinition
another definition
other
,
Project
the current project
project
)

Overrides org.apache.tools.ant.AntTypeDefinition.similarDefinition.

Similar method for this definition
Inherited from org.apache.tools.ant.AntTypeDefinition:
checkClassgetClassLoadergetClassNamegetExposedClassgetNamegetTypeClassinnerCreateAndSetinnerGetTypeClassisRestrictsetAdapterClasssetAdaptToClasssetClasssetClassLoadersetClassNamesetNamesetRestrict

Field Detail

macroDefback to summary
private MacroDef macroDef

Constructor Detail

MyAntTypeDefinitionback to summary
public MyAntTypeDefinition(MacroDef macroDef)

Creates a new MyAntTypeDefinition instance.

Parameters
macroDef:MacroDef

a MacroDef value

Method Detail

createback to summary
public Object create(Project project)

Overrides org.apache.tools.ant.AntTypeDefinition.create.

Create an instance of the definition. The instance may be wrapped in a proxy class.

Parameters
project:Project

the current project

Returns:Object

the created object

Annotations
@Override
sameDefinitionback to summary
public boolean sameDefinition(AntTypeDefinition other, Project project)

Overrides org.apache.tools.ant.AntTypeDefinition.sameDefinition.

Equality method for this definition

Parameters
other:AntTypeDefinition

another definition

project:Project

the current project

Returns:boolean

true if the definitions are the same

Annotations
@Override
similarDefinitionback to summary
public boolean similarDefinition(AntTypeDefinition other, Project project)

Overrides org.apache.tools.ant.AntTypeDefinition.similarDefinition.

Similar method for this definition

Parameters
other:AntTypeDefinition

another definition

project:Project

the current project

Returns:boolean

true if the definitions are the same

Annotations
@Override
org.apache.tools.ant.taskdefs back to summary

public Class MacroDef.NestedSequential

extends Object
implements TaskContainer
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.TaskContainer

The class corresponding to the sequential nested element. This is a simple task container.

Field Summary

Modifier and TypeField and Description
private List<Task>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addTask(Task
an unknown element.
task
)

Implements org.apache.tools.ant.TaskContainer.addTask.

Add a task or type to the container.
public List<Task>

Returns:

the list of unknown elements
getNested
()

public boolean

Returns:

true if they are similar, false otherwise
similar
(MacroDef.NestedSequential
the nested sequential to compare with.
other
)

A compare function to compare this with another NestedSequential.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nestedback to summary
private List<Task> nested

Constructor Detail

NestedSequentialback to summary
public NestedSequential()

Method Detail

addTaskback to summary
public void addTask(Task task)

Implements org.apache.tools.ant.TaskContainer.addTask.

Add a task or type to the container.

Parameters
task:Task

an unknown element.

Annotations
@Override
getNestedback to summary
public List<Task> getNested()
Returns:List<Task>

the list of unknown elements

similarback to summary
public boolean similar(MacroDef.NestedSequential other)

A compare function to compare this with another NestedSequential. It calls similar on the nested unknown elements.

Parameters
other:MacroDef.NestedSequential

the nested sequential to compare with.

Returns:boolean

true if they are similar, false otherwise

org.apache.tools.ant.taskdefs back to summary

public Class MacroDef.TemplateElement

extends Object
Class Inheritance

A nested element for the MacroDef task.

Field Summary

Modifier and TypeField and Description
private String
private boolean
private String
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

a boolean value
equals
(Object
an Object value
obj
)

Overrides java.lang.Object.equals.

equality method.
public String

Returns:

the description of the element, or null if no description is available.
getDescription
()

Gets the description of this element.

public String

Returns:

the name of the element.
getName
()

Gets the name of this element.

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean

Returns:

the implicit attribute
isImplicit
()

Gets whether this element is implicit.

public boolean

Returns:

the optional attribute
isOptional
()

Gets whether this element is optional.

public void
setDescription(String
Description of the element.
desc
)

Sets a textual description of this element, for build documentation purposes only.

public void
setImplicit(boolean
if true this element may be left out, default is false.
implicit
)

Sets whether this element is implicit.

public void
setName(String
the name of the element
name
)

Sets the name of this element.

public void
setOptional(boolean
if true this element may be left out, default is false.
optional
)

Sets whether this element is optional.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

descriptionback to summary
private String description
implicitback to summary
private boolean implicit
nameback to summary
private String name
optionalback to summary
private boolean optional

Constructor Detail

TemplateElementback to summary
public TemplateElement()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

equality method.

Parameters
obj:Object

an Object value

Returns:boolean

a boolean value

Annotations
@Override
getDescriptionback to summary
public String getDescription()

Gets the description of this element.

Returns:String

the description of the element, or null if no description is available.

Since
ant 1.6.1
getNameback to summary
public String getName()

Gets the name of this element.

Returns:String

the name of the element.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isImplicitback to summary
public boolean isImplicit()

Gets whether this element is implicit.

Returns:boolean

the implicit attribute

isOptionalback to summary
public boolean isOptional()

Gets whether this element is optional.

Returns:boolean

the optional attribute

setDescriptionback to summary
public void setDescription(String desc)

Sets a textual description of this element, for build documentation purposes only.

Parameters
desc:String

Description of the element.

Since
ant 1.6.1
setImplicitback to summary
public void setImplicit(boolean implicit)

Sets whether this element is implicit.

Parameters
implicit:boolean

if true this element may be left out, default is false.

setNameback to summary
public void setName(String name)

Sets the name of this element.

Parameters
name:String

the name of the element

setOptionalback to summary
public void setOptional(boolean optional)

Sets whether this element is optional.

Parameters
optional:boolean

if true this element may be left out, default is false.

org.apache.tools.ant.taskdefs back to summary

public Class MacroDef.Text

extends Object
Class Inheritance

A nested text element for the MacroDef task.
Since
ant 1.6.1

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public
Text()

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

a boolean value
equals
(Object
an Object value
obj
)

Overrides java.lang.Object.equals.

equality method
public String

Returns:

the default text if set, null otherwise.
getDefault
()

public String

Returns:

the description of the text, or null if no description is available.
getDescription
()

public String

Returns:

the name of the attribute
getName
()

public boolean

Returns:

true if the text is optional
getOptional
()

public boolean

Returns:

true if the text is trim
getTrim
()

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public void
setDefault(String
default text for the string.
defaultString
)

public void
setDescription(String
Description of the text.
desc
)

public void
setName(String
the name of the attribute
name
)

The name of the attribute.

public void
setOptional(boolean
if true this is optional
optional
)

The optional attribute of the text element.

public void
setTrim(boolean
if true this String.trim() is called on the contents of the text element.
trim
)

The trim attribute of the text element.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultStringback to summary
private String defaultString
descriptionback to summary
private String description
nameback to summary
private String name
optionalback to summary
private boolean optional
trimback to summary
private boolean trim

Constructor Detail

Textback to summary
public Text()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

equality method

Parameters
obj:Object

an Object value

Returns:boolean

a boolean value

Annotations
@Override
getDefaultback to summary
public String getDefault()
Returns:String

the default text if set, null otherwise.

getDescriptionback to summary
public String getDescription()
Returns:String

the description of the text, or null if no description is available.

getNameback to summary
public String getName()
Returns:String

the name of the attribute

getOptionalback to summary
public boolean getOptional()
Returns:boolean

true if the text is optional

getTrimback to summary
public boolean getTrim()
Returns:boolean

true if the text is trim

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
setDefaultback to summary
public void setDefault(String defaultString)
Parameters
defaultString:String

default text for the string.

setDescriptionback to summary
public void setDescription(String desc)
Parameters
desc:String

Description of the text.

setNameback to summary
public void setName(String name)

The name of the attribute.

Parameters
name:String

the name of the attribute

setOptionalback to summary
public void setOptional(boolean optional)

The optional attribute of the text element.

Parameters
optional:boolean

if true this is optional

setTrimback to summary
public void setTrim(boolean trim)

The trim attribute of the text element.

Parameters
trim:boolean

if true this String.trim() is called on the contents of the text element.