Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12248

Re: Hairy generics question

From Steven Simpson <ss@domain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Hairy generics question
Date 2012-02-22 08:31 +0000
Organization Aioe.org NNTP Server
Message-ID <uole19-a24.ln1@s.simpson148.btinternet.com> (permalink)
References <3c65271e-a388-49c9-bcc6-ca3bf274e74f@e27g2000vbu.googlegroups.com> <v2Y0r.9874$yb.2452@newsfe20.iad>

Show all headers | View raw


On 22/02/12 02:04, Daniel Pitts wrote:
> I think what you'll need to do is have generic parameter to CompA:
>
> public class CompA<View extends CompItemViewInterface<AInfo, 
> CompA<View>, View>> extends CompItem<AInfo, CompA<View>, View>

I think you then have to do the same for your AInfo, with corresponding 
changes to CompA's declaration:

class CompA<View extends CompItemViewInterface<AInfo<View>,
                                                CompA<View>, View>>
     extends CompItem<AInfo<View>, CompA<View>, View>  { }
class AInfo<View extends CompItemViewInterface<AInfo<View>,
                                                CompA<View>, View>>
     extends CompItemInfo<AInfo<View>, CompA<View>, View>  { }



For the interested, here's an SSCCE, with CompC as the special case, and 
CompA and CompB defined as before (and a few bits guessed):

interface CompWidget<T>  { }

class CompItemInfo
     <T extends CompItemInfo<T, P, V>,
      P extends AbstractCompItem<T, P, V>,
      V extends CompItemViewInterface<T, P, V>>  { }

interface CompItemViewInterface
     <T extends CompItemInfo<T, P, V>,
      P extends AbstractCompItem<T, P, V>,
      V extends CompItemViewInterface<T, P, V>>  { }

abstract class AbstractCompItem
     <T extends CompItemInfo<T, P, V>,
      P extends AbstractCompItem<T, P, V>,
      V extends CompItemViewInterface<T, P, V>>  { }

abstract class CompItem
     <T extends CompItemInfo<T, P, V>,
      P extends AbstractCompItem<T, P, V>,
      V extends CompItemViewInterface<T, P, V>>
     extends AbstractCompItem<T, P, V>
     implements CompWidget<T>  { }

class CompItemView
     <T extends CompItemInfo<T, P, V>,
      P extends AbstractCompItem<T, P, V>,
      V extends CompItemViewInterface<T, P, V>>
     extends AbstractCompItemView<T, P, V>
     implements CompItemViewInterface<T, P, V>  { }

abstract class AbstractCompItemView
     <T extends CompItemInfo<T, P, V>,
      P extends AbstractCompItem<T, P, V>,
      V extends CompItemViewInterface<T, P, V>>  { }



class CompA extends CompItem<AInfo, CompA, CompAView>  { }

class AInfo extends CompItemInfo<AInfo, CompA, CompAView>  { }

class CompAView implements CompItemViewInterface<AInfo, CompA, CompAView>  { }



class CompB extends CompItem<BInfo, CompB, CompBView>  { }

class BInfo extends CompItemInfo<BInfo, CompB, CompBView>  { }

class CompBView implements CompItemViewInterface<BInfo, CompB, CompBView>  { }



class CompC<View extends CompItemViewInterface<CInfo<View>,
                                                CompC<View>, View>>
     extends CompItem<CInfo<View>, CompC<View>, View>  { }


class CInfo<View extends CompItemViewInterface<CInfo<View>,
                                                CompC<View>, View>>
     extends CompItemInfo<CInfo<View>, CompC<View>, View>  { }





-- 
ss at comp dot lancs dot ac dot uk

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hairy generics question sclaflin <steve@steveclaflin.com> - 2012-02-21 06:30 -0800
  Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 09:24 -0800
  Re: Hairy generics question Roedy Green <see_website@mindprod.com.invalid> - 2012-02-21 11:05 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 12:09 -0800
  Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-21 18:04 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 18:31 -0800
    Re: Hairy generics question Steven Simpson <ss@domain.invalid> - 2012-02-22 08:31 +0000
  Re: Hairy generics question sclaflin@webucator.com - 2012-02-24 11:12 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-24 12:03 -0800
      Re: Hairy generics question sclaflin@webucator.com - 2012-02-24 14:07 -0800
        Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-24 15:36 -0800
          Re: Hairy generics question sclaflin@webucator.com - 2012-02-25 10:27 -0800
          Re: Hairy generics question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-26 13:13 -0400
            What is Model View Presenter. (Was: Hairy generics question) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-26 10:22 -0800
              Re: What is Model View Presenter. (Was: Hairy generics question) Lew <noone@lewscanon.com> - 2012-02-26 13:08 -0800
                Re: What is Model View Presenter. (Was: Hairy generics question) Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:17 -0500
                Re: What is Model View Presenter. (Was: Hairy generics question) sclaflin@webucator.com - 2012-02-28 06:22 -0800
            Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 09:46 -0800
              Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 09:49 -0800
              Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-28 12:45 -0800
              Re: Hairy generics question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-29 19:37 -0400
                Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-29 22:32 -0800

csiph-web