Since I am only able to pass simple beans around using my Web Service
framework, I wonder how to incorporate business logic around these beans.
My idea was to let my Beans be the base class and simply extend these
with more sophisticated classes with the nessesary business logic
inside. However, when I do a cast from MyObjectBean to MyObject I get a
ClassCastExcept ion. Is it not possible to cast in this direction?
public class MyObjectBean
{
publc MyObjectBean(){ }
private String strMember;
public setStrMemeber(S tring str)
{
strMember = str;
}
public getStrMemeber()
{
return strMember;
}
}
public class MyObject extends MyObjectBean
{
public void print()
{
System.out.prin tln(this.getStr Member());
}
}
....
MyObjectBean myobjectbean = new MyObjectBean();
MyObject mo = ( (MyObject)myobj ectbean ).print(); << ClassCastExcept ion
....
Thanks in advance,
Casper
framework, I wonder how to incorporate business logic around these beans.
My idea was to let my Beans be the base class and simply extend these
with more sophisticated classes with the nessesary business logic
inside. However, when I do a cast from MyObjectBean to MyObject I get a
ClassCastExcept ion. Is it not possible to cast in this direction?
public class MyObjectBean
{
publc MyObjectBean(){ }
private String strMember;
public setStrMemeber(S tring str)
{
strMember = str;
}
public getStrMemeber()
{
return strMember;
}
}
public class MyObject extends MyObjectBean
{
public void print()
{
System.out.prin tln(this.getStr Member());
}
}
....
MyObjectBean myobjectbean = new MyObjectBean();
MyObject mo = ( (MyObject)myobj ectbean ).print(); << ClassCastExcept ion
....
Thanks in advance,
Casper
Comment