I have a string field that may contain whitespaces at leading and trailing. I want to trim these whitespaces and return trimmed text using ConstraintValidator
. If the text is null, I want to return null.
When looking at the implementation examples as shown on this link, I am not sure how can I create a method that gets string and return string instead of isValid()
method. So, how can I implement this approach based on the given scenario?