We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the following class:
/** * A custom violation that includes a prefix which is shown with the violation message. */ @Getter @ToString public class PrefixedViolation extends ConstraintViolation { /** * The wrapped violation. */ private final ConstraintViolation violation; /** * The message prefix. */ private final String prefix; private PrefixedViolation(ConstraintViolation constraintViolation, String prefix) { super(constraintViolation.name(), constraintViolation.messageKey(), constraintViolation.defaultMessageFormat(), constraintViolation.args(), new SimpleMessageFormatter(), constraintViolation.locale()); this.violation = constraintViolation; this.prefix = prefix; } /** * Returns a prefixed violation with no prefix. */ public static PrefixedViolation withoutPrefix(ConstraintViolation violation) { return new PrefixedViolation(violation, ""); } /** * Returns a prefixed violation with the specified prefix. */ public static PrefixedViolation withPrefix(ConstraintViolation violation, String prefix) { return new PrefixedViolation(violation, prefix); } /** * The prefixed violation message. */ public String message() { return prefix + super.message(); } }
I would like to use the MessageFormatter messageFormatter; from the ConstraintViolation but it doesn't expose it.
MessageFormatter messageFormatter;
ConstraintViolation
Could it be added?
Currently, I am adding the new SimpleMessageFormatter()
new SimpleMessageFormatter()
Solution, add:
MessageFormatter messageFormatter() { return messageFormatter; }
I think that adding it would not be a harm.
Thank you.
The text was updated successfully, but these errors were encountered:
Actually extending ConstraintViolation was not expected. Why did you need PrefixedViolation ?
PrefixedViolation
Sorry, something went wrong.
No branches or pull requests
I have the following class:
I would like to use the
MessageFormatter messageFormatter;
from theConstraintViolation
but it doesn't expose it.Could it be added?
Currently, I am adding the
new SimpleMessageFormatter()
Solution, add:
I think that adding it would not be a harm.
Thank you.
The text was updated successfully, but these errors were encountered: