velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: Introspection weirdness?
Date Mon, 12 Nov 2001 18:20:16 GMT
Sorry - really tired :)

Didn't read what you wrote - more below...

On 11/12/01 1:05 PM, "Michael McKibben" <> wrote:

>> I assume that isFinal() and isStatic() are public methods?
>> Geir
>>>>> 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!
>>>>> 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
>>>>> 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?

I guess I am really tired, because I didn't see them as package private. In
1.4, ClassDoc is public, ProgramElementDoc is public... Where am I missing

Are you saying we are getting fooled?

Geir Magnusson Jr.                           
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 address at

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message