velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve O'Hara" <soh...@pivotal-solutions.co.uk>
Subject RE: Inhrited public methods not visible to Velocity
Date Thu, 15 Oct 2009 09:34:22 GMT
Of course, it turned out to be an error on my part.... sorry about that

However as an aside, I changed the velocity code to call getMethods and removed the recursion
in ClassMap.java and that worked fine.  I know it's only a small thing and it's not exactly
a fix because the code isn't broken, but maybe it's worth making the change for the small
amount of possible performance gain.  I'll leave it up to you.

Cheers,
Steve


-----Original Message-----
From: Steve O'Hara 
Sent: 15 October 2009 09:22
To: Velocity Users List
Subject: RE: Inhrited public methods not visible to Velocity

Hi Nathan,

Thanks for your reply - I'm using v6.2
Yes, the abstract class is public and the methods in the abstract class are also public.

I've taken another look at ClassMap.java and can see how you're recursing up the super classes
to get all the public methods.  Forgive my naivety, but why is this necessary?  Wouldn't a
simple call to getMethods() do this for you which would also save having to check if the method
is public?  

I'll see if I can debug why the introspector is not working in my case and come back to the
list.

Steve


-----Original Message-----
From: user-return-20992-sohara=pivotal-solutions.co.uk@velocity.apache.org [mailto:user-return-20992-sohara=pivotal-solutions.co.uk@velocity.apache.org]
On Behalf Of Nathan Bubna
Sent: 14 October 2009 20:38
To: Velocity Users List
Subject: Re: Inhrited public methods not visible to Velocity

On Wed, Oct 14, 2009 at 8:44 AM, Steve O'Hara
<sohara@pivotal-solutions.co.uk> wrote:
> I have a class that extends an abstract class which is placed into a
> Velocity context.  However, the public methods of the abstract class are
> not visible to Velocity.

is the abstract class public?  VelocityTools itself does this successfully.

> I looked at the source code and can see that getDeclaredMethods() is
> being used rather than getMethods()
>
> Is there a reason for that?

Yes, the intention is to support public methods declared in public
classes.  So we navigate the class heirarchy looking for those.

It's also always helpful with such questions to mention the version of
Velocity being used.

>
> Thanks,
> Steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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



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


Mime
View raw message