문제

I'd like to create a custom Java Annotation, which can be applied to a method in an interface. What I'd like is, that when I override the method, that belongs to that interface, an annotation gets above the overridden method automatically.

This is my very simple interface, used for callback:

public interface ChangeToArcherNotifier {
    public void ChangeToArcher();
}

And when I implement it, I want that method to be marked with an annotation, like this:

@Callback
@Override
public void ChangeToArcher() {

}
도움이 되었습니까?

해결책

You cannot do this. If you program in Notepad e.g., who do you expect to paste the annotation name above the method in the source file of the class implementing the interface? This is up to your IDE (if the IDE supports such a feature).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top