IN PROGRESS - issue SWF-720: Multiple checkboxes to Collection mapping
http://jira.springframework.org/browse/SWF-720
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user