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
Post a Comment