On 11/6/07, Rob Hills <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> This one's really a Java question, but I know there are lots of you there
> that know much more Java than I do.
>
> I have some functionality I wish to include in all of my Manager classes
> so I started down the track of trying to create an
> abstract BaseManagerImpl class. My problem is that I've not found any
> acceptable way of extending the AppFuse
> GenericManager class.
>
> If I use a class signature like this:
>
> public abstract class BaseManagerImpl<T, PK extends Serializable> extends
> GenericManager<T, PK> { .... }
>
> then I get an "implicit super constructor is undefined..." compile error.
>
> I can add a constructor of course, but I really want to delegate that to
> inheriting classes the way you do with abstract
> methods. Of course, Java won't let you define abstract constructors :-(
If the class is abstract, it does not much matter what you make the
constructor. The real issue here is that Java only allows super(), which
means that any class that extends your base manager can only access the
constructors in the immediate super class. In your terms that means any
constructors defined in your BaseManager. If you do not provide a
constructor that extends the contstructor in GenericManager, then
GenericManager's constructor will no longer be available - clearly an error!
In short: even if it is an abstract class, it has to provide a valid
constructor for its super class.
Mike
Is what I'm trying to do simply not possible in Java, or am I going the
> wrong way about it?
>
> I know that GenericManager doesn't have a lot of stuff in it and I could
> simply create my own version as a base class, but
> for future maintainability and upgradeability, I'd prefer to keep the
> AppFuse base class in there.
>
> Any thoughts welcome.
>
> TIA,
> Rob Hills
> Waikiki, Western Australia
> Mobile +61 (412) 904-357
> Fax: +61 (8) 9529-2137
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>