Stripes

Allow adding TypeConverters and Formatters without extending TypeConverterFactory or FormatterFactory

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
    None

Description

TypeConverters and Formatters should be able to be configured in web.xml. Since both interfaces take a generic type parameter, Stripes should be able to use that type parameter to register the converter or formatter with the default implementations of TypeConverterFactory and FormatterFactory.

Activity

Hide
Iwao AVE! added a comment - 10/Dec/07 9:06 PM

I have been considering this for a while.
Can't we use annotation for that?
For example:

@TypeConverterFor(Date.class)
public class MyDateTypeConverter implements TypeConverter

{...}

@FormatterFor(MyOrder.class)
public class MyOrderFormatter implements Formatter{...}

This might be a topic which should be explained on the wiki if it can be achieved by extending the default factories.
Just an idea...

Show
Iwao AVE! added a comment - 10/Dec/07 9:06 PM I have been considering this for a while. Can't we use annotation for that? For example: @TypeConverterFor(Date.class) public class MyDateTypeConverter implements TypeConverter {...} @FormatterFor(MyOrder.class) public class MyOrderFormatter implements Formatter{...} This might be a topic which should be explained on the wiki if it can be achieved by extending the default factories. Just an idea...
Hide
Tim Fennell added a comment - 21/Dec/07 12:06 PM

We took a slightly different tack on this one. There's a new public method on the TypeConverterFactory and FormatterFactory interfaces called add() that allows user-space code to add new converters and formatters directly. This could be called from a ServletContextListener or base ActionBean.

Also, see STS-436 for a more generic way to automatically find and use lots of "stripes extensions" kind of classes.

Show
Tim Fennell added a comment - 21/Dec/07 12:06 PM We took a slightly different tack on this one. There's a new public method on the TypeConverterFactory and FormatterFactory interfaces called add() that allows user-space code to add new converters and formatters directly. This could be called from a ServletContextListener or base ActionBean. Also, see STS-436 for a more generic way to automatically find and use lots of "stripes extensions" kind of classes.

People

Vote (0)
Watch (0)

Dates

  • Created:
    10/Dec/07 7:35 PM
    Updated:
    04/Jan/11 3:10 PM
    Resolved:
    21/Dec/07 12:06 PM