users@jaxb.java.net

Re: generics in XSD ?

From: Sang Go <sanghgo_at_gmail.com>
Date: Wed, 2 Apr 2008 12:19:34 -0400

You would need one method that figures out what the Object is, then
calls your other specific methods. For instance,

class A {
    processAttachment(Object obj) {
        if (obj.getClass == PdfAttachment.class)
            processPdfAttachment((PdfAttachment)obj);
         ....
         processPdfAttachment(PdfAttachment obj) { ... }
         processFlashAttachment(FlashAttachment obj) { ... }
         processGifAttachment(GifAttachment obj) { ... }
         processHtmlAttachment(HtmlAttachment obj) { ... }
   }


On Wed, Apr 2, 2008 at 12:09 PM, Felipe Gaúcho <fgaucho_at_gmail.com> wrote:
> actually, in my case the operations are like that:
>
> class A {
> processPdfAttachment(PdfAttachment obj) { ... }
> processFlashAttachment(FlashAttachment obj) { ... }
> processGifAttachment(GifAttachment obj) { ... }
> processHtmlAttachment(HtmlAttachment obj) { ... }
> }
>
> all these "attachments types" are subclasses of the AbstractAttachment.....
>
> the idea was:
>
> class A {
> processAttachment(Attachment<T> obj) { ... }
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>



-- 
Sang Go.