valentinajemuovic / banking-kata-java

Banking Kata (Java)
MIT License
346 stars 92 forks source link

Adapter - Messaging - RabbitMQ - Pattern Matching for instanceof #119

Open valentinajemuovic opened 1 year ago

valentinajemuovic commented 1 year ago
          @eamtalu, you can use the feature "Pattern Matching for instanceof" (JEP 394) here, so you won't need to make the casting, following the example and documentation:
if (eventDto instanceof AccountOpenedDto accountOpenedDto) {
    System.out.println(accountOpenedDto);
}

doc: https://docs.oracle.com/en/java/javase/17/language/pattern-matching-instanceof-operator.html

_Originally posted by @JoaoCipriano in https://github.com/valentinacupac/banking-kata-java/pull/117#discussion_r1227434137_

valentinajemuovic commented 1 year ago

@eamtalu feel free to consider this.