Re: XML attribute value indirection

List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> Tue, 11 Oct 2005 13:54:30 -0600
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
>
> I assume you would like to change the Converter.convert(Class, Attribute,
> Localizer) to
> Converter.convert(Class, Attribute, Object localizedAttributeValue),
> correct?
>

Actually, I was thinking the change would look more like

Converter.convert(Class, Attribute)

The reason why I thought this way is that the Parser only deals w/ strings;
and the Converters' job is to turn those strings into other kinds of objects.

The Parser (as demo-ed unclearly in the diff I submitted) just examines
the attribute value, and if that value needs to be "translated", it just
replaces the translated value with the original:


<                 String key = attr.getValue();
<                 String value = getChainedLocalizer().getString(key);
<                 if (!key.equals(value))
<                     attr.setValue(value);


-Babak.

P.S.  On a separate note--but while we're on the topic-- I'm not sure
I understand what role the "Class" parameter in Converter.convert() plays?
After all, by the time we pick the right Converter, we already know
what type it will be converting to...  (It's not like the caller can *tell* the
implementation which type to convert to, and I can't find a single place
where a Converter implementation uses this parameter...)