if (!(javaMember instanceof AccessibleObject)) {
Class<? extends Member> memberType = javaMember == null ? null : javaMember.getClass();
throw new GenerationException(
"Found a SingularAttribute whose Java Member is not a field or a method (it is a " + memberType + ")");
}
AccessibleObject member = (AccessibleObject) javaMember;
if (member.getAnnotation(ManyToMany.class) != null) {
ManyToMany anno = member.getAnnotation(ManyToMany.class);
return anno.cascade();
}
if (member.getAnnotation(ManyToOne.class) != null) {
ManyToOne anno = member.getAnnotation(ManyToOne.class);
return anno.cascade();
}
if (member.getAnnotation(OneToMany.class) != null) {
OneToMany anno = member.getAnnotation(OneToMany.class);
return anno.cascade();
}
if (member.getAnnotation(OneToOne.class) != null) {
OneToOne anno = member.getAnnotation(OneToOne.class);
return anno.cascade();
}
// the member must not be a relationship (or at least not the owning side of one)
return null;