ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kuiper, Arnout" <Arnout.Kui...@nl.origin-it.com>
Subject RE: Ant Principles (Argument passing)
Date Fri, 21 Apr 2000 16:47:06 GMT
> From: James Duncan Davidson [mailto:james.davidson@eng.sun.com]
> > The original proposal goes further. Besides the String and
> > primitive types, any class that has a String-constructor
> > is acceptable (Like File and StringReader to name a few), so
> > the following setters are acceptable:
> 
> Yep.. That's the nice ting about using the String parameter 
> constructor
> of the object. 
> 
> > 1. setFoo(String) -> use String value
> > 2. setFoo(primitive) -> cast String value to primitive and
> >                         use it
> > 3. setFoo(SomeObject) -> See below
> > 
> > SomeObject is allowed under the following conditions:
> > 1. it has a single-argument String-constructor or,
> > 2. it has a single-argument primitive-constructor or,
> 
> Actually, we could just support first class objects with this as there
> are object wrappers for primitives that have String constructors.. :)
> Simplifies life.

All this casting and converting is just for the convenience of
task writers. Therefore I want to allow also the primitive types.
I forgot about the wrapper classes, but they should also be supported.

> 
> > 3. it has a single-argument constructor with the type
> >    File or URL (Which is constructed using the String
> >    value)
> 
> Covered by 1, no?

No, 1 more level of indirection, although nice to have, still
a point of discussion. Let's show it with an example:

<someelement dir="../test.class"/>

void setDir(MyDirObject value);

class MyDirObject {
  MyDirObject(File file) {...}
}

Note that File has a String-constructor.

For point one, the following example should explain:

<someelement dir="../test.class"/>

void setDir(MyDirObject value);

class MyDirObject {
  MyDirObject(String file) {...}
}

Hope this clarifies it.

  Arnout

Mime
View raw message