velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent van Beveren <vinc...@nazarene.nl>
Subject Context availability during method invocation / ReferenceInsertionEventHandler
Date Thu, 06 Jan 2005 15:12:40 GMT
Hi everyone,

I've searched through the JavaDocs' and source code to find a solution 
for the following problem, but I don't think there are any facilities 
for it, but maybe someone has an idea. I would like to simplify the 
following piece Velocity code:

$locale = ... user defined locale ...      // this is done while setting 
up the context

Description: $product.description.toString($locale)
Title: $product.title.toString($locale)

In which the class product has a method 'getDescription' which returens 
a home-made object of the class LocaleData. LocaleData is basically a 
map with as key a locale and as value an object, usually a string. 
Somewhat like a ResourceBundle (but not quite)

The simplified version would be like this.

$locale = ... user defined locale ...// this is done while setting up 
the context

Description: $product.description
Title: $product.title

As you can see, the whole localized stuff is gone. As far as I can see 
this can be done in two ways: Either I extend the Uberspector to 
recognize the return-type of getDescription and create the correct 
handler for it, or I intercept objects of the type LocaleData with a 
ReferenceInsertionEventHandler, and replace them for their data in the 
correct locale. Both ways though, run into dead ends. Both in the 
Uberspector as the ReferenceInsertionEventHandler the context is not 
available.

I found a spark of hope when I saw

   /**
     * Execute method against context.
     */
    public Object OLDexecute(Object o, InternalContextAdapter context)
        throws IllegalAccessException, MethodInvocationException
    { ..

in the GetExecutor. Unfortunatly, it seems to be deprecated, and no 
longer in use.

Anyone has any idea how to accompish automatic parsing of localized data?

Thanks in advance,
Vincent





-- 
XIAM Solutions B.V.
Barchman Wuytierslaan 72A
3818 LK AMERSFOORT
tel. : +31(0)33 462 40 07
e-mail: vincent@nazarene.nl, info@xiam.nl

WAARSCHUWING:
Dit bericht is UITSLUITEND bestemd voor de (rechts)perso(o)n(en) aan welke het bericht is
gericht. Het kan vertrouwelijke of alleen voor deze rechts)perso(o)n(en) bestemde informatie
bevatten, die niet mag worden geopenbaard. Als dit bericht niet voor u bestemd is, mag u de
ontvangen informatie niet lezen, gebruiken, verspreiden of kopiƫren. Als u dit bericht per
abuis heeft ontvangen, gelieve het bericht dan te vernietigen en contact op te nemen met de
afzender.

WARNING:
This message is intended ONLY for the person(s) or entity to which it is addressed and may
contain confidential and/or privileged information, the disclosure of which is prohibited.
If you are not the intended recipient you may not read, use, disseminate or copy the information
transmitted. If you have received this message by mistake, please contact the sender and delete
the material from any computer.



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 3-1-2005


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Mime
View raw message