I kind of like this one. Except that it doesn't allow
CompoundConverters. But then again, with concept like this there is no
need for compound converters.
-Matej
Igor Vaynberg wrote:
yes i know it was never a stack, i propose to make it a stack
i was talking about the usecase of replacing the default
converterfactory to globally install your own converter.
youd have to do something like this:
newConver(Class c) {
if (c==myclass) {
return new MyConverter();
else return defaultFactory.newConverter(c);
}
instead with a stack and supports(Class) you just do
return new DefaultConverterFactory().add(new MyConvereter()); where
add() does the push onto the stack
-Igor
On 5/17/06, *Johan Compagner* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
everybody used it to replace stuff.
Because everybody now needed to (or did) override the component
getConveter()
and it was never a stack by the way, it was always a map (but in the
end the result is the same ofcourse)
But that doesn't matter and that is still possible because we have
still the factory to create youre own ISupplyConveter
So you still can create create a Convereter like before and call
add(Class,Converter)
But maybe you want a converter that has some kind of session state
(by default now none of the converters have that anymore)
johan
On 5/17/06, * Igor Vaynberg* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
supports wasnt to replace the type parameters, it was to ease
with registration
instead of doing something like
Map<Class,IConverter> registry;
registry.put(String.class, new StringConverter());
registry.get (String.class);
you have
Stack<IConverter> registry;
stack.push(new StringConverter());
and you search for the converter by iterating over the stack
this way if a user wants to override any of the default
converters they just push it onto the stack and its
supports(Class) is called before any of our default ones since
they are lower on the stack.
so instead of overriding+checking+delegating like you have to do
now if youw ant to provide your own factory you simply do return
super.getDefaultFactory().add(new MyStringConverter());
-Igor
On 5/17/06, *Eelco Hillenius* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
I'm still a bit worried about the naming etc.
In my opinion, the thing we want to do is to do input-output
conversion for models. Models could do this themselves, but
pulling
the conversion out makes things way more flexible. So... as
this is
what we are doing, I would propose to choose a name that
reflects
this, for example:
IModelConverter {
String toOutput(Object modelValue);
Object toInput(String requestValue);
boolean supports(Class type);
}
I'm not sure about the type paramter vs supports.
Eelco
On 5/17/06, Igor Vaynberg < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
> we might also consider adding IConverter.supports(Class)
to make
> registration easier.
>
> -Igor
>
>
>
> On 5/14/06, Johan Compagner < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
> >
> > Hi,
> >
> > first currently we have IConverter and ITypeConverter ,
i want to combine
> those 2 to be one interface
> > And then a converter must be easy to make but also to
understand.
> >
> > So i can do this:
> >
> > IConverter.convertToObject (String, Class)
> > IConverter.convertToString(Object)
> >
> > Then writing a DateConverter is pretty simple, you have one
> SimpleDateFormat (or more per locale)
> > and then in toObject you do parse and in toString you do
format
> >
> > The thing is we loose a bit of the more "generic" nature
we have now
> > because in the current setup we could do:
> >
> > conveter.convert(new Double(10), Integer.class) to
convert from a double
> to a integer.
> > Do we need this? We could make:
> >
> > IConverter.convertObject(Object, Class) instead of
> IConverter.convertToObject(String, Class)
> > besides to convertToString.
> >
> > But that would complicate converters again.
> >
> > That Class param can be ignored by a Converter impl (or
it could check if
> it was the type for which this converter is build.)
> > But having that class param there then it is possible to
make a compound
> converter and only have one interface
> > so that you can much easier make youre converter for a
specific textfield.
> >
> >
> > johan
> >
> >
> >
>
>
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
<http://sel.as-us.falkag.net/sel?cmdlnk&kid%120709&bid&3057&dat%121642>
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
<mailto:Wicket-develop@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop