I'm using spring and cglib and i have those classes:
public class A {
.
.
private Souscripteur souscripteur;
private List<B> contrat;
// getter and setter
}
public class B {
.
.
private Souscripteur souscripteur;
//getter and setter
}
and the Class A and B have the same souscripteur, so when i load the Class A and try to load the class B, i get the Souscripteur of the class B EnhancerByCGLIB.
For that, when i try to do this :
if(b.getSouscriteur() instanceof PersonnePhysique) {
//do something
} else {
//do nothing
}
when i inspect the code, the object enhanced is a PersonnePhysique, but if(b.getSouscriteur() instanceof PersonnePhysique) return false
My class PersonnePhysique is like this :
public class PersonnePhysique extends Souscriteur {
//
}