Perhaps something is getting confused because its the same property
name, elements, with different types (Collection vs. List).

On 4/8/07, Alejandro Scandroli <[EMAIL PROTECTED]> wrote:
Hi

I'm trying to reuse/extend some components and I have some problems
with inherited properties and/or methods.
I did a little test case to show what I'm trying to do.

ComponentC.java
public abstract class ComponentC extends BaseComponent
{
  public abstract Collection getElements();
}

ComponentD.java
public abstract class ComponentD extends ComponentC
{
  public abstract List getElements();
}

And the test it self.
public class ComponentsReuseTest extends TestCase
{
  protected Creator creator = new Creator();

  public void testComponentC()
  {
    ComponentC component = (ComponentC) creator.newInstance(ComponentC.class,
        new Object[]{
            "elements", new ArrayList()
        });

    assertNotNull(component);
    assertNotNull(component.getElements());
  }

  public void testComponentD()
  {
    ComponentD component = (ComponentD) creator.newInstance(ComponentD.class,
        new Object[]{
            "elements", new ArrayList()
        });
    assertNotNull(component);
    assertNotNull(component.getElements());
  }
}

The testComponentD fails with this error message:
org.apache.hivemind.ApplicationRuntimeException: Property elements of
object [EMAIL PROTECTED] is read-only.
        at 
org.apache.hivemind.util.PropertyAdaptor.write(PropertyAdaptor.java:86)
(....)

Do you find something wrong in what I'm trying to do here? I'm using
Tapestry 4.0.2

BTW, the asset "$template" is enormously  useful when you want to
reuse components but change only the java code.


Alejandro.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to