banking-kata-java icon indicating copy to clipboard operation
banking-kata-java copied to clipboard

Adapter - Messaging - RabbitMQ - Pattern Matching for instanceof

Open valentinajemuovic opened this issue 1 year ago • 1 comments

          @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 avatar Jun 13 '23 11:06 valentinajemuovic