search supertypes for session getter in repository type

This commit is contained in:
Gavin King 2023-09-02 20:34:09 +02:00
parent 2cfe93cd88
commit a541a64eec
1 changed files with 17 additions and 4 deletions

View File

@ -283,7 +283,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
}
}
findSessionGetter( methodsOfClass );
findSessionGetter( element );
if ( managed ) {
putMember( "class", new AnnotationMetaType(this) );
@ -301,14 +301,27 @@ public class AnnotationMetaEntity extends AnnotationMeta {
initialized = true;
}
private void findSessionGetter(List<ExecutableElement> methodsOfClass) {
if ( !containsAnnotation( element, Constants.ENTITY ) ) {
for ( ExecutableElement method : methodsOfClass ) {
private void findSessionGetter(TypeElement type) {
if ( !containsAnnotation( type, Constants.ENTITY ) ) {
for ( ExecutableElement method : methodsIn( type.getEnclosedElements() ) ) {
if ( isSessionGetter( method ) ) {
dao = true;
sessionType = addDaoConstructor( method );
}
}
if ( !dao ) {
final TypeMirror superclass = type.getSuperclass();
if ( superclass.getKind() == TypeKind.DECLARED ) {
final DeclaredType declaredType = (DeclaredType) superclass;
findSessionGetter( (TypeElement) declaredType.asElement() );
}
for ( TypeMirror superinterface : type.getInterfaces() ) {
if ( superinterface.getKind() == TypeKind.DECLARED ) {
final DeclaredType declaredType = (DeclaredType) superinterface;
findSessionGetter( (TypeElement) declaredType.asElement() );
}
}
}
}
}