Ejemplo n.º 1
0
 protected Object[] getArgumentsForConstraint(
     String objectName, String field, ConstraintDescriptor<?> descriptor) {
   List<Object> arguments = new LinkedList<>();
   String[] codes = new String[] {objectName + Errors.NESTED_PATH_SEPARATOR + field, field};
   arguments.add(new DefaultMessageSourceResolvable(codes, field));
   // Using a TreeMap for alphabetical ordering of attribute names
   Map<String, Object> attributesToExpose = new TreeMap<>();
   for (Map.Entry<String, Object> entry : descriptor.getAttributes().entrySet()) {
     String attributeName = entry.getKey();
     Object attributeValue = entry.getValue();
     if (!internalAnnotationAttributes.contains(attributeName)) {
       attributesToExpose.put(attributeName, attributeValue);
     }
   }
   arguments.addAll(attributesToExpose.values());
   return arguments.toArray(new Object[arguments.size()]);
 }