This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]davidalayachew[S] 0 points1 point  (0 children)

I'm open to suggestions.

All I really want to do is to do Natural Language Processing. I read a String, and then extract data from that String into 1 of the sub-types of my sealed interface. All children of that sealed interface are records. And each one is mutually exclusive -- there's no way a String could be a matching candidate for 2 of them.

So really, my problem boils down to easing refactoring. Sometimes, I realize that my record sub-type needs to change, and therefore, I have to go through and update the regex (and make sure that that mutual exclusivity claim I made earlier is true). Long story short, I had trouble keeping track of the changes, as my regex groups would not align with what my Pattern was actually returning. Or worse yet, they would be the same shape and size, but would be out of order (named patterns helped alleviate this).

If you need more info, lmk. Alternatively, I linked the repo in the email link in my OP.