4 Replies Latest reply on Oct 27, 2016 7:15 PM by Laird Nelson

    Specializing a bean you don't control?

    Laird Nelson Apprentice

      How do you specialize a bean you don't control? I hope this is a sensible question.

       

      What I mean is: suppose a colleague hands me a bean archive with a FrobnicatorImpl bean in it (that implements Frobnicator).

       

      Suppose further I don't want to, or cannot, know anything about FrobnicatorImpl, but I do know what it means to implement Frobnicator. Moreover, Is like to "fully replace" all usages of FrobnicatorImpl with  MyFrobnicator.

       

      I know that I would make MyFrobnicator an alternative. But I am fuzzy about how to avoid the traps mentioned in the spec around alternatives. Specialization, if I am reading things right, which is designed to avoid the traps, says that MyFrobnicator would have to extend FrobnicatorImpl. But what would I do if extending that class is not an option?

       

      I know this is a rookie question and so am prepared for Pointers To Elsewhere™. Thanks!