velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <geirmagnusso...@yahoo.com>
Subject Re: Introspection weirdness?
Date Mon, 12 Nov 2001 18:05:11 GMT
On 11/12/01 12:55 PM, "Michael McKibben" <mike@hihat.net> wrote:

> Okay. I'll try against the HEAD. I was using the 1.2-rc2 binary.

Stop then - the 1.2 has the fixes in place, so that's not it.

I assume that isFinal() and isStatic() are public methods?

Geir

> 
> Regards,
> 
> --mike
> 
> On Mon, 12 Nov 2001, Geir Magnusson Jr. wrote:
> 
>> There were some issues in 1.1 that have been fixed.
>> 
>> Try the v1.2-rc or the current CVS HEAD.
>> 
>> Let us know.
>> 
>> Geir
>> 
>> 
>> On 11/12/01 12:44 PM, "Michael McKibben" <mike@hihat.net> wrote:
>> 
>>> 
>>> Hello, I have run into a problem that I was hoping someone on this list
>>> has seen before. I am using Velocity in a javadoc doclet to generate xml
>>> documentation and the template engine is having trouble introspecting the
>>> com.sun.javadoc.* interfaces. For example, I do something like the
>>> following in the doclet:
>>> 
>>> com.sun.javadoc.ClassDoc classDoc = ...
>>> velocityContext.put("classDoc", classDoc);
>>> 
>>> And then in the VTL I try to call methods on the ClassDoc interface:
>>> 
>>> <javadoc:class 
>>> name="$classDoc.qualifiedName()"
>>> final="$classDoc.isFinal()"
>>> static="$classDoc.isStatic()">
>>> ...
>>> </javadoc:class>
>>> 
>>> Here is the weird part. Velocity correctly handles some of the method
>>> class; however it doesn't find the 'isFinal' and 'isStatic' methods! The
>>> only way I can get my template to work correctly is if I create a wrapper
>>> class and delegate the calls to the ClassDoc methods.
>>> 
>>> This suggests to me that Velocity's introspection is broken. Looking at
>>> the implementation of the com.sun.javadoc.* interfaces, they are declared
>>> package private. This is a common introspection mistake. The way to handle
>>> this case is to call getInterfaces() and replace any public methods with
>>> those found in the implemented interfaces. java.beans.Introspector
>>> correctly handles this. Perhaps
>>> org.apache.velocity.util.introspection.Introspector should use this?
>>> 
>>> Regards,
>>> 
>>> --mike
>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <mailto:velocity-user-help@jakarta.apache.org>
>>> 
>> 
>> -- 
>> Geir Magnusson Jr.                       geirm@optonline.net
>> System and Software Consulting
>> You're going to end up getting pissed at your software
>> anyway, so you might as well not pay for it. Try Open Source.
>> 
>> 
>> 
>> _________________________________________________________
>> Do You Yahoo!?
>> Get your free @yahoo.com address at http://mail.yahoo.com
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
>> <mailto:velocity-user-help@jakarta.apache.org>
>> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:velocity-user-help@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message