use of ezvcard.ValidationWarnings in project ez-vcard by mangstadt.
the class Agent method _validate.
@Override
protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard) {
if (url == null && this.vcard == null) {
warnings.add(new ValidationWarning(8));
}
if (this.vcard != null) {
NumberFormat nf = NumberFormat.getIntegerInstance();
nf.setMinimumIntegerDigits(2);
ValidationWarnings validationWarnings = this.vcard.validate(version);
for (Map.Entry<VCardProperty, List<ValidationWarning>> entry : validationWarnings) {
VCardProperty property = entry.getKey();
List<ValidationWarning> propViolations = entry.getValue();
for (ValidationWarning propViolation : propViolations) {
String className = (property == null) ? "" : property.getClass().getSimpleName();
int code = propViolation.getCode();
String codeStr = (code >= 0) ? "W" + nf.format(code) : "";
String message = propViolation.getMessage();
warnings.add(new ValidationWarning(10, className, codeStr, message));
}
}
}
}
Aggregations