Methods Summary |
---|
public void | addConfiguredAttribute(org.apache.tools.ant.taskdefs.MacroDef$Attribute attribute)Add an attribute element.
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);
|
public void | addConfiguredElement(org.apache.tools.ant.taskdefs.MacroDef$TemplateElement element)Add an element 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(org.apache.tools.ant.taskdefs.MacroDef$Text text)Add the text element.
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 org.apache.tools.ant.taskdefs.MacroDef$NestedSequential | createSequential()This is the sequential nested element of the macrodef.
if (this.nestedSequential != null) {
throw new BuildException("Only one sequential allowed");
}
this.nestedSequential = new NestedSequential();
return this.nestedSequential;
|
public void | execute()Create a new ant type based on the embedded tasks and types.
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);
|
public java.util.List | getAttributes()Gets this macro's attribute (and define?) list.
return attributes;
|
public boolean | getBackTrace()
return backTrace;
|
public java.util.Map | getElements()Gets this macro's elements.
return elements;
|
public org.apache.tools.ant.UnknownElement | getNestedTask()Convert the nested sequential to an unknown element
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;
|
public org.apache.tools.ant.taskdefs.MacroDef$Text | getText()
return text;
|
private static boolean | isValidName(java.lang.String name)Check if a string is a valid name for an element or attribute.
if (name.length() == 0) {
return false;
}
for (int i = 0; i < name.length(); ++i) {
if (!isValidNameCharacter(name.charAt(i))) {
return false;
}
}
return true;
|
public static boolean | isValidNameCharacter(char c)Check if a character is a valid character for an element or
attribute name.
// ? is there an xml api for this ?
return Character.isLetterOrDigit(c) || c == '." || c == '-";
|
private static int | objectHashCode(java.lang.Object o)
if (o == null) {
return 0;
} else {
return o.hashCode();
}
|
public boolean | sameDefinition(java.lang.Object obj)Equality method for this definition
return sameOrSimilar(obj, true);
|
private boolean | sameOrSimilar(java.lang.Object obj, boolean same)same or similar equality method for macrodef, ignores project and
runtime info.
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (!obj.getClass().equals(getClass())) {
return false;
}
MacroDef other = (MacroDef) obj;
if (name == null) {
return other.name == null;
}
if (!name.equals(other.name)) {
return false;
}
// Allow two macro definitions with the same location
// to be treated as similar - bugzilla 31215
if (other.getLocation() != null
&& other.getLocation().equals(getLocation())
&& !same) {
return true;
}
if (text == null) {
if (other.text != null) {
return false;
}
} else {
if (!text.equals(other.text)) {
return false;
}
}
if (getURI() == null || getURI().equals("")
|| getURI().equals(ProjectHelper.ANT_CORE_URI)) {
if (!(other.getURI() == null || other.getURI().equals("")
|| other.getURI().equals(ProjectHelper.ANT_CORE_URI))) {
return false;
}
} else {
if (!getURI().equals(other.getURI())) {
return false;
}
}
if (!nestedSequential.similar(other.nestedSequential)) {
return false;
}
if (!attributes.equals(other.attributes)) {
return false;
}
if (!elements.equals(other.elements)) {
return false;
}
return true;
|
public void | setBackTrace(boolean backTrace)Set the backTrace attribute.
this.backTrace = backTrace;
|
public void | setName(java.lang.String name)Name of the definition
this.name = name;
|
public boolean | similar(java.lang.Object obj)Similar method for this definition
return sameOrSimilar(obj, false);
|