I haven't tried this but this might work:
DataValidationInfo dvi = new DataValidationInfo(SomeObject.getMendixObject().getId().toLong());
dvi.addErrorField(SomeProxyObject.MemberNames.Email.toString(), "some validation message");
getContext().addDataValidation(dvi);
SomeObject.getMendixObject().getId().toLong() = the guid of the object the attribute belongs to
SomeProxyObject.MemberNames.Email.toString() = the membername, so the name of the attribute or association where you would like to show a validation message.
context.addFeedback is used to sent generic feedback to the client to open/close a page, show a popup etc.