Check out an example of utilising Generics and maintaining runtime type safety with Service API.

See:

http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/

StreamServiceRegistrar and MarshalledServiceItem (extends ServiceItem) are part of the Service API.

ResultStream<T>, is an interface using generics.

StreamServiceRegistrar uses ResultStream, but reverts to the default type, Object.

ServiceResultStreamFilter and ServiceResultStreamUnmarshaller are client utility classes that utilise Generic's, implement ResultStream and are used by the client to manipulate the results from StreamServiceRegistrar and MarshalledServiceItem.


Cheers,

Peter.

Reply via email to