[Prev] Thread [Next]  |  [Prev] Date [Next]

Create custom datatype programmatically Mansour Al Akeel Fri Feb 03 23:00:38 2012

In the class org.apache.tools.ant.Project, theres a method called
createDataType(String str).
The string argument, is the name of the type to be created.

1- This can not be used if the new type is defined in a custom antlib.xml,
because it is not recognized.
for example getProject.createDataType("jar") would create an instance of
the Jar Task. Which not what I need.
And if I don getProject.createDataType("myCustomType"),  where myCustomType
is defined in an antlib.xml, it will return null.

2- If the type name in antlib.xml is changed then this has to be renamed.

I am not sure if it's better to use full class name as the name of the
type, but this will not make it possible to create types defined, in
Any advice about how to create an instance of myCustomType grammatically ?