/** * Creates a new instance of a data type. * * @param typeName The name of the data type to create an instance of. * Must not be <code>null</code>. * * @return an instance of the specified data type, or <code>null</code> if * the data type name is not recognised. * * @exception BuildException if the data type name is recognised but * instance creation fails. */ public Object createDataType(String typeName) throws BuildException { return createComponent(typeName); }
private MethodAndObject createTopLevel( final ComponentHelper helper, final String elementName, final List<Method> methods) { final Class<?> clazz = helper.getComponentClass(elementName); if (clazz == null) { return null; } final Method addMethod = findMatchingMethod(clazz, addTypeMethods); if (addMethod == null) { return null; } final Object addedObject = helper.createComponent(elementName); return new MethodAndObject(addMethod, addedObject); }
return null; Object obj = createComponent(taskType); if (obj == null) { return null;
nestedObject = helper.createComponent(polyType); if (nestedObject == null) { throw new BuildException("Unable to create object of type " + polyType);
/** * Factory method to create the components. * * This should be called by UnknownElement. * * @param ue The Unknown Element creating this component. * @param ns Namespace URI. Also available as ue.getNamespace(). * @param componentType The component type, * Also available as ue.getComponentName(). * @return the created component. * @throws BuildException if an error occurs. */ public Object createComponent(UnknownElement ue, String ns, String componentType) throws BuildException { Object component = createComponent(componentType); if (component instanceof Task) { Task task = (Task) component; task.setLocation(ue.getLocation()); task.setTaskType(componentType); task.setTaskName(ue.getTaskName()); task.setOwningTarget(ue.getOwningTarget()); task.init(); } return component; }
getProject()); String name = ue.getComponentName(); Object o = helper.createComponent(ue, ue.getNamespace(), name); if (o == null) { throw getNotFoundException("task or type", name);