Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 42666 invoked by uid 500); 20 Jan 2001 13:41:56 -0000 Delivered-To: apmail-jakarta-ant-cvs@apache.org Received: (qmail 42662 invoked by uid 1142); 20 Jan 2001 13:41:56 -0000 Date: 20 Jan 2001 13:41:56 -0000 Message-ID: <20010120134156.42661.qmail@apache.org> From: conor@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant IntrospectionHelper.java conor 01/01/20 05:41:56 Modified: src/main/org/apache/tools/ant IntrospectionHelper.java Log: Remove the concept of a factory method for creating nested elements Revision Changes Path 1.13 +6 -31 jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java Index: IntrospectionHelper.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- IntrospectionHelper.java 2001/01/20 11:10:25 1.12 +++ IntrospectionHelper.java 2001/01/20 13:41:56 1.13 @@ -96,13 +96,6 @@ private Method addText = null; /** - * The method used to add nested elements which can't be added through - * nested creators. It allows a task to define a factory method for creating - * nested elements. - */ - private Method elementFactoryMethod = null; - - /** * The Class that's been introspected. */ private Class bean; @@ -145,14 +138,6 @@ && java.lang.String.class.equals(args[0])) { addText = methods[i]; - - } else if ("createElement".equals(name) - && !returnType.isArray() - && !returnType.isPrimitive() - && args.length == 1 - && java.lang.String.class.equals(args[0])) { - - elementFactoryMethod = methods[i]; } else if (name.startsWith("set") && java.lang.Void.TYPE.equals(returnType) @@ -281,23 +266,13 @@ public Object createElement(Object element, String elementName) throws BuildException { NestedCreator nc = (NestedCreator) nestedCreators.get(elementName); + if (nc == null) { + String msg = "Class " + element.getClass().getName() + + " doesn't support the nested \"" + elementName + "\" element"; + throw new BuildException(msg); + } try { - if (nc == null) { - Object nestedElement = null; - if (elementFactoryMethod != null) { - nestedElement - = elementFactoryMethod.invoke(element, new Object[] {elementName}); - } - if (nestedElement == null) { - String msg = "Class " + element.getClass().getName() + - " doesn't support the nested \"" + elementName + "\" element"; - throw new BuildException(msg); - } - return nestedElement; - } - else { - return nc.create(element); - } + return nc.create(element); } catch (IllegalAccessException ie) { // impossible as getMethods should only return public methods throw new BuildException(ie);