You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Davide Mora <d_...@yahoo.com> on 2001/03/29 16:25:32 UTC

Re: how cast an object? [my fault :(]

Hi! Forget about this question, was my fault,
everything work ok!
Thank you! 

--- Davide Mora <d_...@yahoo.com> wrote:
> 
> Hi!
> 
> I have the following problem, i already found a
> workaround but i'm curious of know if there is a
> better way for make it.
> 
> I have the following classes:
> 
> public class Type
> {
>   ...
>   public String getName()
>   {
>     ...
>   }
> }
> 
> public class Classifier extends Type
> {
>   ...
>   public Classifier getParent()
>   {
>     ...
>   }
> }
> 
> public class Attribute
> {
>   /* Type or Classifier */
>   public Type getType()
>   {
>     ...
>   }
> }
> 
> before run my template i bind a collection of
> Attributes as "attributes", and in my template i try
> to access to access Classifier#getParent:
> 
> #foreach( $attr in $attributes)
>  $attr.type.parent.name
> #endif
> 
> .. and doesnt work.
> Maybe i'm wrong, but seems like the the class type
> of
> $attr.type was takend from the signature of
> Attribute#getType instead of from the instance of
> the
> returned object. I hope make sense.
> 
> Any other ideas?
> Davide
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/?.refer=text


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

Re: how cast an object? [my fault :(]

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Davide Mora wrote:
> 
> Hi! Forget about this question, was my fault,
> everything work ok!
> Thank you!

(I was hoping :)

> 
> --- Davide Mora <d_...@yahoo.com> wrote:
> >
> > Hi!
> >
> > I have the following problem, i already found a
> > workaround but i'm curious of know if there is a
> > better way for make it.
> >
> > I have the following classes:
> >
> > public class Type
> > {
> >   ...
> >   public String getName()
> >   {
> >     ...
> >   }
> > }
> >
> > public class Classifier extends Type
> > {
> >   ...
> >   public Classifier getParent()
> >   {
> >     ...
> >   }
> > }
> >
> > public class Attribute
> > {
> >   /* Type or Classifier */
> >   public Type getType()
> >   {
> >     ...
> >   }
> > }
> >
> > before run my template i bind a collection of
> > Attributes as "attributes", and in my template i try
> > to access to access Classifier#getParent:
> >
> > #foreach( $attr in $attributes)
> >  $attr.type.parent.name
> > #endif
> >
> > .. and doesnt work.
> > Maybe i'm wrong, but seems like the the class type
> > of
> > $attr.type was takend from the signature of
> > Attribute#getType instead of from the instance of
> > the
> > returned object. I hope make sense.
> >
> > Any other ideas?
> > Davide
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get email at your own domain with Yahoo! Mail.
> > http://personal.mail.yahoo.com/?.refer=text
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/?.refer=text

-- 
Geir Magnusson Jr.                               geirm@optonline.net
Developing for the web?  See http://jakarta.apache.org/velocity/