Hi, I just wanted to share my experiences here with generifying some of the commons packages. I’ve been through several of them, when I needed them. The last one, just not, is CLI.
One package, however, is impossible to make generic. IMHO, this indicates a design flaw, although I admit that it’s a clever trick. Tha package org.jakarta.commons.cli2.validation contains the interface Validator: public interface Validator { void validate(final List values) throws InvalidArgumentException; } What the several validators do is check whether the list contains Strings that follow some format (a Date, a Number, a Class) and then replace those strings with the corresponding item *in the same list*. So the input is clearly always a List<String>, but after the method is finished, this list will no longer contain strings, but something else. Clearly, with generics, this is impossible to express. A proper way to do this would be to return another list. The only class that really does validation is EnumValidator, but since there are real enums in Java 5 now, it is no longer needed. Therefore I would suggest totally rethinking this package. Probably the best way to go is to deprecate the whole package and use Transformers as they can be found in Commons Collections, along with Predicates or some other tool for this. H. -- Hendrik Maryns Herrenberger Straße 40 D-72070 Tübingen +49707143783 http://tcl.sfs.uni-tuebingen.de/~hendrik/ ================= www.lieverleven.be Hier kan iedereen wat van leren.
signature.asc
Description: OpenPGP digital signature