TOP

method.new

Description

Construct a Java object Calls the constructor with the parameters provided on the named class and stores the result into the property with the name provided. The result object is stored as an object value of the named property.

Implementation class

net.mdatools.modelant.util.task.CallConstructorTask

Parameters

Attribute Description Type
class The qualified name of the class to call a static method of String
classpath A path as a string to append to the classpath Path
classpathRef A path as a reference to append to the classpath Reference
name This is the mandatory name where to store the method's result. Default: this String
parentFirst Indicates if the classpath should be searched first, before the standard classes (false) or use the standard classes first (true). Note that false might make different versions of the same class. Default: true boolean

Nested elements

Element Description
parameter Support of nested <parameter> element describing the signature of the method and the actual parameter to call it with A single parameter and of a method call & its description. It holds class name, an explicit string value or a name to find the value bound to. Invariant:
  1. when class name is null or empty (not provided), then String class is implied. The class is searched in the standard class loader.
  2. if value name is provided, then it defines the value to use. No type conversion is done. If no property with that name is bound, null value will be used.
  3. if no value name provided, then the string value is used, no matter if it is provided or not and it is converted to the target class using a constructor with a single String parameter. If no string value provided, null value will be used.
 Usage: 
   
   class X extends Task {
     private final TypeValueDescriptor parameter = new TypeValueDescriptor(this); // used the constructor with Task 
   }
   
   or
 
   class X extends Task {
     public void addConfiguredY(TypeValueDescriptor parameter) { // ANT calls the constructor with the Project parameter
        parameter.setTask( this );
        ...
     }
   }
 

Parameters

Attribute Description Type
class The name of the class of this parameter. Default: String String
classpath The classpath to search for the parameter's class. Default: the ANT class path Path
classpathRef The reference to classpath to search for the parameter's class. Default: the ANT class path Reference
parentFirst The if the classpath provided should be searched after the ANT classpath. Default: true boolean
property The name of the property that holds the value to send as a parameter value. Default: this String
signature The class to be used in the method' signature. Thus, a singing value and valueClassName could describe an Object parameter as a signature class name. String
value An explicit String value to send as a parameter value. If provided valueName is disregarded String

Use <typedef resource="net/mdatools/modelant/util/antlib.xml"/>
Documentation generated by ant.doc Ant macro from ModelAnt by MDA Tools