users@jaxb.java.net

Re: generics in XSD ?

From: Kenny MacLeod <kennym_at_kizoom.com>
Date: Wed, 2 Apr 2008 17:06:01 +0100

Are you sure you're not putting too much faith in generics here?

What's the difference between

class A<T> {
        processAttachment(T mime) { ... }
}

and

class A {
        processAttachment(Object mime) { ... }
}

Both are semantically identical. In both cases, you have to inspect the
type of the mime argument and call the appropriate helper class.


Felipe Gaúcho wrote:
> I know.. but a syntatic sugar very tastefull :) eheheh, really .. not
> a big deal.. but I can define an operation
>
> class A<T> {
> processAttachment(T mime) { ... } <-------- this will be
> supported by 1 helper class for each mime type..
> }
>
> the contract becomes more clean.. the traditional OO alternative, I
> must create 1 method for each mime type :(
>
> it is just the difference between declare 20 methods or declare just 1
> supported by 20 helper classes,.... not a big deal,
>
> but as "contract", I suppose something understandable by business
> people, an an specification with 20 lines is less digestible than 1
> line saying "here we pass an attachment".. (the dirty details about
> mime types should be restricted to the developers...) I can hide the
> types from the business scared eyes using an xsd import, but with OO
> Iwill need the 20 different operations to do exactly the same
> functionality but with mime types different :(
>
> BTW: my under progress example can be found here:
> https://cejug-classifieds.dev.java.net/
> the WSDL is here:
> https://cejug-classifieds.dev.java.net/source/browse/cejug-classifieds/trunk/cejug-classifieds-server/resources/contract/
>
> thanks for your support.. If you have a good idea on how to define
> different attachment operations based on its types....... :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>