Skip to content

ViolationMessage.of() with arguments #448

Open
@ffroliva

Description

@ffroliva

Dear Maki,

Some times need to create messages and I use ViolationMessage.of() for that.

However ViolationMessage doesn't accept arguments. This limits me to only have plain messages.

For example consider a message as follows: "Please provide a number between {0} and {1}" and I need to send the arguments to be resolved. Some times I use the messageKey and I would need to have the arguments available to be resolved in a GlobalExceptionHandler with a MessageSource to be translated.

Currently I am addressing that with CustomConstraints but It would be useful to have another constructor to resolve te argumentos in ViolationMessage.of()

I understand that in CustomConstraint the first attribute is the name so {0} is reserved.

My suggestion: ViolationMessage.of(String messageKey, String defaultMessageFormat, Object[] args)

What are you thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions