@Override
 public String toString() {
   StringBuilder sb = new StringBuilder();
   sb.append(getClass().getSimpleName()).append("\n");
   if (_initMessages.isEmpty() == false) {
     sb.append("Initialization message:\n");
     _initMessages.appendTo(sb);
   }
   sb.append("Validators:\n");
   for (Map.Entry<Object, List<Validator>> e : _cache.entrySet()) {
     sb.append("  ");
     Object key = e.getKey();
     if (key instanceof RecordDataSchema.Field) {
       sb.append(((RecordDataSchema.Field) key).getName()).append(" (field)");
     } else if (key instanceof NamedDataSchema) {
       sb.append(((NamedDataSchema) key).getFullName()).append(" (named schema)");
     } else {
       sb.append(key.toString());
     }
     sb.append("\n");
     for (Validator v : e.getValue()) {
       sb.append("    ").append(v).append("\n");
     }
   }
   return sb.toString();
 }
Ejemplo n.º 2
0
 protected void checkMessageListForErrorsAndThrowDataTranslationException()
     throws DataTranslationException {
   if (_messageList.isEmpty() == false) {
     Object[] firstErrorPath = _messageList.get(0).getPath();
     throw new DataTranslationException(
         "Error processing " + pathToString(Arrays.asList(firstErrorPath)), _messageList);
   }
 }