ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Lalevée <nicolas.lale...@hibnet.org>
Subject Re: svn commit: r1035335 - in /ant/core/trunk/src/main/org/apache/tools/ant: ProjectHelper.java helper/ProjectHelper2.java taskdefs/BindTargets.java
Date Mon, 15 Nov 2010 17:24:18 GMT

Le 15 nov. 2010 à 17:27, Dominique Devienne a écrit :

> On Mon, Nov 15, 2010 at 10:09 AM,  <hibou@apache.org> wrote:
>> +    public final static class OnMissingExtensionPoint {
> 
> I was actually thinking of
> org.apache.tools.ant.types.EnumeratedAttribute when I mentioned an
> enum, because from my recollection IntrospectionHelper was aware of
> it, but perhaps the valueOf() method you defined is a similar
> "protocol / convention" IH is aware of as well, and the derivation
> from EnumeratedAttribute is not necessary?

I saw that class EnumeratedAttribute, but it helps to define enums only from the IntrospectionHelper.
When I started to use that class, the strings no-so-enum were still "leaked" through the Java
API of the ProjectHelper.
So I implemented a class that behave like the Java 5 enums, where there is no possibility
at compile time to have any other value than the predefined ones. Then on the IntrospectionHelper
side, it still see a simple string. So the code that checks the values is still in the implementation
of the target (well actually delegated with some error rethrowing).

But maybe I should continue, make an EnumeratedAttribute which make the bridge with the enum
like class OnMissingExtensionPoint. But it won't save much code.

I got an idea. What about creating an interface Enum which will be a marker for classes which
are expected to have a valueOf static method (like for every enum in java 5), and have IntrospectionHelper
support that ? I think that it could be done easily in IntrospectionHelper#getEnumSetter .
WDYT ?

Nicolas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message