0

Following sample is just to explain the my implementation, please have a look at and let me know if i can get any answers for this

I have created a annotation Dispenser

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Dispenser {

}

I have two classes of type dispenser above

  1. Milk Dispenser --
  2. Drink Dispenser --

    @Dispenser
    class MilkDispenser{
    
        public void releaseDrink()
    }
    
    @Dispenser
    class DrinkDispenser{
    
        public void releaseDrink()
    }
    

and i have a class DispenserProcessor extends AbstractProcessor

Everything looks fine until unless i found a better implmentation of DispenserProcessor from the client they have their own implementation I cannot copy their code so i need a way switch to that dispenserProcessor developed by the client instead of mine

Question, is there any way @MyDispenser can extend their @ClientDispenser

Samuel Edwin Ward
  • 6,526
  • 3
  • 34
  • 62
Maddy
  • 85
  • 11
  • Thanks Samuel, I understand as of now there is no reason of using it. So i changed my requirement a little and changed the implementation to use Dynamic proxies to solve the issue. – Maddy Jan 17 '15 at 20:16

1 Answers1

0

It seems like you would have to use annotation inheritance to support this, but annotation inheritance is not supported.

More info here: Why is not possible to extend annotations in Java?

Community
  • 1
  • 1
Samuel Edwin Ward
  • 6,526
  • 3
  • 34
  • 62