I don't mean to be insulting, but you seem to be operating with a very poor
understand of Java classes/interfaces/objects/references.
You do not cast one class to another.  You cast one object to a particular class.

For example, you might have:

AbstractPersistentIF po = loadObject(x);
PartnerIF partner = (PartnerIf)po;
PersonIF person = (PersonIf)po
OrganizationIf org = (OrganizationIF)po;

Now, depending on the class of the object that the po reference refers to, you
could have between zero and three ClassCastExceptions

David


|---------+--------------------------->
|         |           Joerg Lensing   |
|         |           <[EMAIL PROTECTED]|
|         |           nsing.de>       |
|         |                           |
|         |           09/11/2003 06:57|
|         |           AM              |
|         |           Please respond  |
|         |           to "OJB Users   |
|         |           List"           |
|         |                           |
|---------+--------------------------->
  
>--------------------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                                                          |
  |        To:      OJB Users List <[EMAIL PROTECTED]>                                 
                                                                     |
  |        cc:                                                                         
                                                                          |
  |        Subject: Proxy: ClassCastException with casting interface                   
                                                                          |
  |                                                                                    
                                                                          |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------------------|



Hi all,
I have problems with casting interfaces (a $Proxy).
The classes are:
AbstractPersistentIF
|_PartnerIF
...|_OrganisationIF
...|_PersonIF

this is OK:     (PartnerIF)AbstractPersistentIF
      this too   (PersonIF)AbstractPersistentIF

this causes ClassCastException: (OrganisationIF)AbstractPersistentIF


any hints / solutions?

tx Joerg





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







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

Reply via email to