Does the Swing API have classes which combine InputVerifiers? For example, I have three InputVerifiers in my current project:
- NotEmptyInputVerifier - verifies that a textfield is not empty
- PositiveIntegerInputVerifier - verifies that a text field contains a positive integer
- YearInputVerifier - verifies that a text field contains a four digit year
NotEmptyInputVerifier needs to be used for all input, whether Strings or numerical. PositiveIntegerInput needs to check that the text field is not empty and additionally check that the input string only contains digits. YearInputVerifier needs to also check that the input is exactly four digits, with the leading digit non-zero.
Now each of these builds on the other. I can easily implement this with composition or inheritence. It seems like this pattern would come up quite often in Swing applications and I think a little wrapper class, say AndInputVerifier, would be useful enough to belong in the Swing API. I haven't been able to find one, though, so I think it doesn't exist. ;-(
If not in the Swing API, does anyone know if this exists in a third-party package?