IN PROGRESS - issue SWF-720: Multiple checkboxes to Collection mapping

http://jira.springframework.org/browse/SWF-720
This commit is contained in:
Keith Donald
2008-06-23 14:19:54 +00:00
parent f7d0ec1008
commit 301931e617
6 changed files with 18 additions and 11 deletions

View File

@@ -32,9 +32,10 @@ public interface FormatterRegistry {
/**
* Returns the formatter for the given class of object with the given id. Use this method to query a custom
* formatter instance for a given class of object.
* @param clazz the type of object that will be formatted
* @param id the id of the custom formatter instance; typically descriptive like "localDate"
* @return the formatter
*/
public Formatter getFormatter(String id);
public Formatter getFormatter(Class clazz, String id);
}

View File

@@ -42,9 +42,13 @@ public class GenericFormatterRegistry implements FormatterRegistry {
return (Formatter) formattersByClass.get(clazz);
}
public Formatter getFormatter(String id) {
public Formatter getFormatter(Class clazz, String id) {
Assert.notNull(clazz, "The formatted class argument is required");
Assert.hasText(id, "The id of the custom formatter is required");
return (Formatter) formattersById.get(id);
Formatter formatter = (Formatter) formattersById.get(id);
if (formatter != null && formatter.getObjectType().equals(clazz)) {
}
return formatter;
}
// impl