valentinacupac / banking-kata-java

Banking Kata (Java)
MIT License
336 stars 90 forks source link

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

Open valentinacupac opened 1 year ago

valentinacupac 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_

valentinacupac commented 1 year ago

@eamtalu feel free to consider this.