What is events in Otto and are there types of events that could be published using OTTO?

StackOverflow https://stackoverflow.com/questions/20627544

  •  02-09-2022
  •  | 
  •  

Domanda

Iam just a bit confused with what type of events can be published through OTTO. and a example of event class will be really helpful. Thanks

È stato utile?

Soluzione

You can publish any objects. Check the Otto home page. There you see an example where AnswerAvailableEvent event gets published. Event class can look like this.

public class AnswerAvailableEvent {
    private int answer;

    public AnswerAvailableEvent(int answer) {
      this.answer = answer;
    }

    public int getAnswer() {
      return answer;
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top