cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <bimargul...@gmail.com>
Subject The @SuppressWarnings on DataReaders and Writers
Date Wed, 02 Jan 2008 01:41:40 GMT
I'd like, at this point, to quote Alice in Wonderland on the subject of
serpents.

Note that I'm not actually messing with Databinding and DataReader and
DataWriter. I'm using the Aegis standalone API as petri dish.

I've read all the docs I can find on generics, and I've tried a whole
series of experiments.

I am now convinced that there's no such beast as:

<T> DataReader<T> createReader(Class<T> sourceType)

Why? because you can't get a Class object for DataReader<anything>, so
you can't cast to it.

You can have

<T,U> T createReader<Class<T> readerObject, Class<U> sourceObject)

Now, however, we can't define the output as an interface. It has to be a
specific class. What's the use of that?

This seems really silly to me, compared to just defining a set of
function:

DataReader<XMLStreamReader> createXMLStreamReader();
DataReader<Element> createElementReader();
and on down the line.

This, of course, doesn't permit the 'give me a list of classes on which
you can create readers'. 

If anyone out there knows generics better than I do and can write me
what I'm missing, I'm all eyes.



Mime
View raw message