Revision: 678
http://stripes.svn.sourceforge.net/stripes/?rev=678&view=rev
Author: bengunter
Date: 2007-12-12 07:19:25 -0800 (Wed, 12 Dec 2007)
Log Message:
-----------
STS-455: Allow adding TypeConverters and Formatters without extending
TypeConverterFactory or FormatterFactory. Pulled the add(...) methods up from
the default implementations to the FormatterFactory and TypeConverterFactory
interfaces.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/format/FormatterFactory.java
trunk/stripes/src/net/sourceforge/stripes/validation/TypeConverterFactory.java
Modified: trunk/stripes/src/net/sourceforge/stripes/format/FormatterFactory.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/format/FormatterFactory.java
2007-12-12 13:53:24 UTC (rev 677)
+++ trunk/stripes/src/net/sourceforge/stripes/format/FormatterFactory.java
2007-12-12 15:19:25 UTC (rev 678)
@@ -39,4 +39,17 @@
* the type specified
*/
Formatter<?> getFormatter(Class<?> clazz, Locale locale, String
formatType, String formatPattern);
+
+ /**
+ * Adds a formatter to the set of registered formatters, overriding an
existing formatter if one
+ * was already registered for the type. This is an optional operation. If
an implementation does
+ * not support adding formatters at runtime, then it must throw
+ * [EMAIL PROTECTED] UnsupportedOperationException}.
+ *
+ * @param targetType the type for which the formatter will handle
formatting
+ * @param formatterClass the implementation class that will handle the
formatting
+ * @throws UnsupportedOperationException if the implementation does not
support adding
+ * formatters at runtime
+ */
+ public void add(Class<?> targetType, Class<? extends Formatter<?>>
formatterClass);
}
Modified:
trunk/stripes/src/net/sourceforge/stripes/validation/TypeConverterFactory.java
===================================================================
---
trunk/stripes/src/net/sourceforge/stripes/validation/TypeConverterFactory.java
2007-12-12 13:53:24 UTC (rev 677)
+++
trunk/stripes/src/net/sourceforge/stripes/validation/TypeConverterFactory.java
2007-12-12 15:19:25 UTC (rev 678)
@@ -52,4 +52,17 @@
*/
@SuppressWarnings("unchecked")
TypeConverter getInstance(Class<? extends TypeConverter> clazz, Locale
locale) throws Exception;
+
+ /**
+ * Adds a type converter to the set of registered type converters,
overriding an existing
+ * converter if one was already registered for the type. This is an
optional operation.
+ * Implementations that do not support adding type converters at runtime
must throw
+ * [EMAIL PROTECTED] UnsupportedOperationException}.
+ *
+ * @param targetType the type for which the converter will handle
conversions
+ * @param converterClass the implementation class that will handle the
conversions
+ * @throws UnsupportedOperationException if the implementation does not
support adding type
+ * converters at runtime
+ */
+ public void add(Class<?> targetType, Class<? extends TypeConverter<?>>
converterClass);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development