Browse Source

Code cleanup.

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

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

@@ -200,10 +200,7 @@ public class ComponentHelper {
*/
public Object createComponent(String componentName) {
AntTypeDefinition def = getDefinition(componentName);
if (def == null) {
return null;
}
return def.create(project);
return (def == null) ? null : def.create(project);
}

/**
@@ -229,9 +226,7 @@ public class ComponentHelper {
*/
public AntTypeDefinition getDefinition(String componentName) {
checkNamespace(componentName);
AntTypeDefinition ret = null;
ret = antTypeTable.getDefinition(componentName);
return ret;
return antTypeTable.getDefinition(componentName);
}

/**
@@ -803,8 +798,7 @@ public class ComponentHelper {
}

public AntTypeDefinition getDefinition(String key) {
AntTypeDefinition ret = (AntTypeDefinition) super.get(key);
return ret;
return (AntTypeDefinition)(super.get(key));
}

/** Equivalent to getTypeType */
@@ -814,37 +808,28 @@ public class ComponentHelper {

public Object create(String name) {
AntTypeDefinition def = getDefinition(name);
if (def == null) {
return null;
}
return def.create(project);
return (def == null) ? null : def.create(project);
}

public Class getTypeClass(String name) {
AntTypeDefinition def = getDefinition(name);
if (def == null) {
return null;
}
return def.getTypeClass(project);
return (def == null) ? null : def.getTypeClass(project);
}

public Class getExposedClass(String name) {
AntTypeDefinition def = getDefinition(name);
if (def == null) {
return null;
}
return def.getExposedClass(project);
return (def == null) ? null : def.getExposedClass(project);
}

public boolean contains(Object clazz) {
for (Iterator i = values().iterator(); i.hasNext();) {
AntTypeDefinition def = (AntTypeDefinition) i.next();
Class c = def.getExposedClass(project);
if (c == clazz) {
return true;
boolean found = false;
if (clazz instanceof Class) {
for (Iterator i = values().iterator(); i.hasNext() && !found;) {
found |= (((AntTypeDefinition)(i.next())).getExposedClass(
project) == clazz);
}
}
return false;
return found;
}

public boolean containsValue(Object value) {


Loading…
Cancel
Save