code: public static <T> void collectAttributeValues(
              Attributes attributes, String name, Collection<T> collection, Class<T> clazz) {
  
          Assert.notNull(attributes, "Attributes must not be null");
          Assert.hasText(name, "Name must not be empty");
          Assert.notNull(collection, "Collection must not be null");
  
          Attribute attribute = attributes.get(name);
          if (attribute == null) {
              throw new NoSuchAttributeException("No attribute with name '" + name + "'");
          }
  
          iterateAttributeValues(attribute, new CollectingAttributeValueCallbackHandler<T>(collection, clazz));
  
      }
docs: Collect all the values of a the specified attribute from the supplied
  Attributes as the specified class.
  
  @param attributes The Attributes; not <code>null</code>.
  @param name The name of the Attribute to get values for.
  @param collection the collection to collect the values in.
  @param clazz the class of the collected attribute values
  @throws NoSuchAttributeException if no attribute with the specified name
  exists.
  @throws IllegalArgumentException if an attribute value cannot be cast to the specified class.
  @since 2.0