Is there a way to specify the interface/class being overrode using Java's Override annotation? -


some classes have many interfaces inherit from.

i want make explicit in overrided methods interface or class method overrides when @ code month now, don't have linear search on every interface being implemented , class being extended find interface or class method being overrode for.

situation:

class foo extends bar implements foo1, foo2, bar1, bar2 {     public foo(){}      @override     void foo1() {}      @override     void foo2() {}      @override     void bar1() {}      @override     void bar2() {} } 

i want like:

class foo extends bar implements foo1, foo2, bar1, bar2 {     public foo(){}      @overrides(source="foo2")     void foo1() {}      @overrides(source="bar1")     void foo2() {}      @overrides(source="bar2")     void bar1() {}      @overrides(source="foo1")     void bar2() {} } 

is there way accomplish this?

solution (thanks nikem):

can create custom annotation (overrides.java)

public @interface overrides  {     string source() default "";  } 

you can create own annotation purpose. standard @override annotation not allow this.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -