http://blog.hibernate.org/12026.lace ... not sure where the Severity comes from, but haven't looked extensively yet.
looks like the blog example is wrong should be same as in the spec draft.
Code:
package com.acme.severity;
public class Severity {
public static class Info extends ConstraintPayload {};
public static class Error extends ConstraintPayload {};
}
public class Address {
@NotNull(message="would be nice if we had one", payload=Severity.Info.class)
public String getZipCode() {...}
@NotNull(message="the city is mandatory", payload=Severity.Error.class)
String getCity() {...}
}
This is that I don't really understand the big benefit of payloads, especially as classes as "annotation extensions". I already recreated a bunch of constraints with special stuff added, but with the lack of portability, it doesn't offer much for me really. I
might be able use them in place of creating my own constraints, but the cost would probably be as high in terms of creating these weird classes to serve as metadata.