here.
| Method from org.apache.tools.ant.taskdefs.MacroDef Detail: |
public void addConfiguredAttribute(MacroDef.Attribute attribute) {
if (attribute.getName() == null) {
throw new BuildException(
"the attribute nested element needed a \"name\" attribute");
}
if (attribute.getName().equals(textName)) {
throw new BuildException(
"the name \"" + attribute.getName()
+ "\" has already been used by the text element");
}
for (int i = 0; i < attributes.size(); ++i) {
Attribute att = (Attribute) attributes.get(i);
if (att.getName().equals(attribute.getName())) {
throw new BuildException(
"the name \"" + attribute.getName()
+ "\" has already been used in "
+ "another attribute element");
}
}
attributes.add(attribute);
}
Add an attribute element. |
public void addConfiguredElement(MacroDef.TemplateElement element) {
if (element.getName() == null) {
throw new BuildException(
"the element nested element needed a \"name\" attribute");
}
if (elements.get(element.getName()) != null) {
throw new BuildException(
"the element " + element.getName()
+ " has already been specified");
}
if (hasImplicitElement
|| (element.isImplicit() && elements.size() != 0)) {
throw new BuildException(
"Only one element allowed when using implicit elements");
}
hasImplicitElement = element.isImplicit();
elements.put(element.getName(), element);
}
|
public void addConfiguredText(MacroDef.Text text) {
if (this.text != null) {
throw new BuildException(
"Only one nested text element allowed");
}
if (text.getName() == null) {
throw new BuildException(
"the text nested element needed a \"name\" attribute");
}
// Check if used by attributes
for (Iterator i = attributes.iterator(); i.hasNext();) {
Attribute attribute = (Attribute) i.next();
if (text.getName().equals(attribute.getName())) {
throw new BuildException(
"the name \"" + text.getName()
+ "\" is already used as an attribute");
}
}
this.text = text;
this.textName = text.getName();
}
|
public MacroDef.NestedSequential createSequential() {
if (this.nestedSequential != null) {
throw new BuildException("Only one sequential allowed");
}
this.nestedSequential = new NestedSequential();
return this.nestedSequential;
}
This is the sequential nested element of the macrodef. |
public void execute() {
if (nestedSequential == null) {
throw new BuildException("Missing sequential element");
}
if (name == null) {
throw new BuildException("Name not specified");
}
name = ProjectHelper.genComponentName(getURI(), name);
MyAntTypeDefinition def = new MyAntTypeDefinition(this);
def.setName(name);
def.setClass(MacroInstance.class);
ComponentHelper helper = ComponentHelper.getComponentHelper(
getProject());
helper.addDataTypeDefinition(def);
log("creating macro " + name, Project.MSG_VERBOSE);
}
Create a new ant type based on the embedded tasks and types. |
public List getAttributes() {
return attributes;
}
Gets this macro's attribute (and define?) list. |
public boolean getBackTrace() {
return backTrace;
}
|
public Map getElements() {
return elements;
}
Gets this macro's elements. |
public UnknownElement getNestedTask() {
UnknownElement ret = new UnknownElement("sequential");
ret.setTaskName("sequential");
ret.setNamespace("");
ret.setQName("sequential");
new RuntimeConfigurable(ret, "sequential");
for (int i = 0; i < nestedSequential.getNested().size(); ++i) {
UnknownElement e =
(UnknownElement) nestedSequential.getNested().get(i);
ret.addChild(e);
ret.getWrapper().addChild(e.getWrapper());
}
return ret;
}
Convert the nested sequential to an unknown element |
public MacroDef.Text getText() {
return text;
}
|
public static boolean isValidNameCharacter(char c) {
// ? is there an xml api for this ?
return Character.isLetterOrDigit(c) || c == '." || c == '-";
}
Check if a character is a valid character for an element or
attribute name. |
public boolean sameDefinition(Object obj) {
return sameOrSimilar(obj, true);
}
Equality method for this definition |
public void setBackTrace(boolean backTrace) {
this.backTrace = backTrace;
}
Set the backTrace attribute. |
public void setName(String name) {
this.name = name;
}
|
public boolean similar(Object obj) {
return sameOrSimilar(obj, false);
}
Similar method for this definition |