velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davide Mora <d_m...@yahoo.com>
Subject how cast an object?
Date Thu, 29 Mar 2001 13:56:50 GMT

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

Mime
View raw message