Browse Source

Yet more bumming & javadoc. You'd think I'd have stopped by now...

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277228 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 21 years ago
parent
commit
f8bc42dda7
1 changed files with 27 additions and 34 deletions
  1. +27
    -34
      src/main/org/apache/tools/ant/ComponentHelper.java

+ 27
- 34
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -85,10 +85,10 @@ public class ComponentHelper {
private Project project; private Project project;


/** /**
* find a project component for a specific project, creating
* it if it does not exist
* @param project the project
* @return the project component for a specific project
* Find a project component for a specific project, creating
* it if it does not exist.
* @param project the project.
* @return the project component for a specific project.
*/ */
public static ComponentHelper getComponentHelper(Project project) { public static ComponentHelper getComponentHelper(Project project) {
// Singleton for now, it may change ( per/classloader ) // Singleton for now, it may change ( per/classloader )
@@ -111,27 +111,27 @@ public class ComponentHelper {
} }


/** /**
* Set the next chained component helper
* Set the next chained component helper.
* *
* @param next the next chained component helper
* @param next the next chained component helper.
*/ */
public void setNext(ComponentHelper next) { public void setNext(ComponentHelper next) {
this.next = next; this.next = next;
} }


/** /**
* Get the next chained component helper
* Get the next chained component helper.
* *
* @return the next chained component helper
* @return the next chained component helper.
*/ */
public ComponentHelper getNext() { public ComponentHelper getNext() {
return next; return next;
} }


/** /**
* Sets the project for this component helper
* Sets the project for this component helper.
* *
* @param project the project for this helper
* @param project the project for this helper.
*/ */
public void setProject(Project project) { public void setProject(Project project) {
this.project = project; this.project = project;
@@ -142,7 +142,7 @@ public class ComponentHelper {
* Used with creating child projects. Each child * Used with creating child projects. Each child
* project inherits the component definitions * project inherits the component definitions
* from its parent. * from its parent.
* @param helper the component helper of the parent project
* @param helper the component helper of the parent project.
*/ */
public void initSubProject(ComponentHelper helper) { public void initSubProject(ComponentHelper helper) {
// add the types of the parent project // add the types of the parent project
@@ -162,12 +162,12 @@ public class ComponentHelper {
* *
* This should be called by UnknownElement. * This should be called by UnknownElement.
* *
* @param ue The Unknown Element creating this component
* @param ns Namespace URI. Also available as ue.getNamespace()
* @param ue The Unknown Element creating this component.
* @param ns Namespace URI. Also available as ue.getNamespace().
* @param componentType The component type, * @param componentType The component type,
* Also available as ue.getComponentName()
* @return the created component
* @throws BuildException if an error occurs
* Also available as ue.getComponentName().
* @return the created component.
* @throws BuildException if an error occurs.
*/ */
public Object createComponent(UnknownElement ue, public Object createComponent(UnknownElement ue,
String ns, String ns,
@@ -191,7 +191,7 @@ public class ComponentHelper {
* *
* @param componentName the name of the component, if * @param componentName the name of the component, if
* the component is in a namespace, the * the component is in a namespace, the
* name is prefixed with the namespace uri and ":"
* name is prefixed with the namespace uri and ":".
* @return the class if found or null if not. * @return the class if found or null if not.
*/ */
public Object createComponent(String componentName) { public Object createComponent(String componentName) {
@@ -204,7 +204,7 @@ public class ComponentHelper {
* *
* @param componentName the name of the component, if * @param componentName the name of the component, if
* the component is in a namespace, the * the component is in a namespace, the
* name is prefixed with the namespace uri and ":"
* name is prefixed with the namespace uri and ":".
* @return the class if found or null if not. * @return the class if found or null if not.
*/ */
public Class getComponentClass(String componentName) { public Class getComponentClass(String componentName) {
@@ -213,9 +213,9 @@ public class ComponentHelper {
} }


/** /**
* Return the antTypeDefinition for a componentName
* @param componentName the name of the component
* @return the ant definition or null if not present
* Return the antTypeDefinition for a componentName.
* @param componentName the name of the component.
* @return the ant definition or null if not present.
*/ */
public AntTypeDefinition getDefinition(String componentName) { public AntTypeDefinition getDefinition(String componentName) {
checkNamespace(componentName); checkNamespace(componentName);
@@ -392,7 +392,7 @@ public class ComponentHelper {
/** /**
* Describe <code>addDataTypeDefinition</code> method here. * Describe <code>addDataTypeDefinition</code> method here.
* *
* @param def an <code>AntTypeDefinition</code> value
* @param def an <code>AntTypeDefinition</code> value.
*/ */
public void addDataTypeDefinition(AntTypeDefinition def) { public void addDataTypeDefinition(AntTypeDefinition def) {
updateDataTypeDefinition(def); updateDataTypeDefinition(def);
@@ -456,10 +456,7 @@ public class ComponentHelper {
*/ */
private Task createNewTask(String taskType) throws BuildException { private Task createNewTask(String taskType) throws BuildException {
Class c = getComponentClass(taskType); Class c = getComponentClass(taskType);
if (c == null) {
return null;
}
if (!(Task.class.isAssignableFrom(c))) {
if (c == null || !(Task.class.isAssignableFrom(c))) {
return null; return null;
} }
Task task = (Task) createComponent(taskType); Task task = (Task) createComponent(taskType);
@@ -605,17 +602,13 @@ public class ComponentHelper {
if (sameDefinition(def, old)) { if (sameDefinition(def, old)) {
return; return;
} }
int logLevel = Project.MSG_WARN;
if (def.similarDefinition(old, project)) {
logLevel = Project.MSG_VERBOSE;
}
Class oldClass = antTypeTable.getExposedClass(name); Class oldClass = antTypeTable.getExposedClass(name);
boolean isTask = boolean isTask =
(oldClass != null && Task.class.isAssignableFrom(oldClass)); (oldClass != null && Task.class.isAssignableFrom(oldClass));
project.log(
"Trying to override old definition of "
+ (isTask ? "task" : "datatype")
+ " " + name, logLevel);
project.log( "Trying to override old definition of "
+ (isTask ? "task " : "datatype ") + name,
(def.similarDefinition(old, project))
? Project.MSG_VERBOSE : Project.MSG_WARN);
if (isTask) { if (isTask) {
invalidateCreatedTasks(name); invalidateCreatedTasks(name);
} }


Loading…
Cancel
Save