I have 4 interfaces:
public interface Ainterface{
getName()/setName();
getShape()/setShape();
....
}
public interface Binterface extends Ainterface{
getWidth()/setWidth();
getHeight()/setHeight();
...
}
public interface Cinterface extends Ainterface{
getRadius()/setRadius();
...
}
public interface Dinterface {
Ainterface getA();
void setA(Ainterface a);
...
}
I have included all interfaces in my AutoBeanFactory.
Question: when I decode/encode Dinterface, how do I know if Ainterface is extended by Binterface or Cinterface? How does AutoBean support polymorphism?
To make it easier, I can add a variable (for ex, shape) in Ainterface to indicate which Binterface or Cinterface I have and then cast Ainterface to Binterface/Cinterface. However, I run into ClassCastException. Should I have separate interfaces; one that consists Binterface and one consists Cinterface? Is there other solution to this problem?
Thank you,
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/WwTERx0IZRsJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment