You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Paul Smith <Pa...@lawlex.com.au> on 2002/10/17 03:12:20 UTC

class name "Node" issue

Hi,

We have a custom Node tree model in our app, and have a custom "tool" that
is dropped into the Velocity context (via Turbine).  Different objects
extend from our Node parent class.

The Tool has a method that takes a Node object and grabs an internal object
of the Node, and returns a string representation of it.  for purely
demonstration purposes, it looks something like:

$ourTool.formatStuff( $node )

[Where $node is an instance of our Node object, this object is used all over
our app in Turbine/Velocity and working great, so I know it's not a problem
at this level).

For some reason Velocity can't seem to match the method name, and we get the
"Invalid reference" in the velocity log.

What makes this particularly weird, is that if we change the Tool's method
signature to just take the internal object in the first place, and use
Velocity something like as follows:

$ourTool.formatStuff( $node.getInternalObject() )

It works fine.

What makes this even stranger is that that same tool has another method that
takes a parent class (called Attribute) and does different stuff depending
on whether it's of a particular sub-class or not in a similar way, so I know
Velocity is handling inherited class structures fine and matching the method
name ok.

Is it a problem because the class name is called "Node"?  Can anyone think
of any other explanation?

regards,

Paul Smith

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: class name "Node" issue

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 10/16/02 9:12 PM, "Paul Smith" <Pa...@lawlex.com.au> wrote:

> Hi,
> 
> We have a custom Node tree model in our app, and have a custom "tool" that
> is dropped into the Velocity context (via Turbine).  Different objects
> extend from our Node parent class.
> 
> The Tool has a method that takes a Node object and grabs an internal object
> of the Node, and returns a string representation of it.  for purely
> demonstration purposes, it looks something like:
> 
> $ourTool.formatStuff( $node )
> 
> [Where $node is an instance of our Node object, this object is used all over
> our app in Turbine/Velocity and working great, so I know it's not a problem
> at this level).
> 
> For some reason Velocity can't seem to match the method name, and we get the
> "Invalid reference" in the velocity log.

We'll need to know :

1) Version of velocity - there have been some fixes to the introspector
since 1.2

2) Is this method formatStuff(Node) public?

> 
> What makes this particularly weird, is that if we change the Tool's method
> signature to just take the internal object in the first place, and use
> Velocity something like as follows:
> 
> $ourTool.formatStuff( $node.getInternalObject() )

> It works fine.

Yes, that's weird :)
 
> What makes this even stranger is that that same tool has another method that
> takes a parent class (called Attribute) and does different stuff depending
> on whether it's of a particular sub-class or not in a similar way, so I know
> Velocity is handling inherited class structures fine and matching the method
> name ok.
> 
> Is it a problem because the class name is called "Node"?  Can anyone think
> of any other explanation?

That would be horrible :)  I guess we just need to know if the method is
public for starters, or if a method on an interface, if that is public...

-- 
Geir Magnusson Jr. 
geirm@adeptra.com                                    +1-203-355-2219 (w)
Adeptra Inc.                                         +1-203-247-1713 (m)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>