Thursday, March 28, 2013

How to use Gin DI in custom ConstraintValidator (Bean Validation)?

For example i have some CodeValidator with dependencies.

public class ExistingCustomsCodeValidator implements ConstraintValidator<ExistingCustomsCode, String> {
    @Inject private CustomsCodeService customsCodeService;
    @Inject private ProcessingCtx processingCtx;

    @Override public void initialize(ExistingCustomsCode constraintAnnotation) {}

    @Override public boolean isValid(String value, ConstraintValidatorContext context) {
        return customsCodeService.isValid(value, processingCtx.getDeclarationDateTime());
    }
}

I can simply inject dependencies on server-side, but i can't imagine how to do this on client-side.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment