simplification, use getAllMembers() in processor
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
f51d8dbe0d
commit
8992cbbbde
|
@ -379,8 +379,8 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
||||||
final List<ExecutableElement> lifecycleMethods = new ArrayList<>();
|
final List<ExecutableElement> lifecycleMethods = new ArrayList<>();
|
||||||
|
|
||||||
if ( repository ) {
|
if ( repository ) {
|
||||||
final List<ExecutableElement> methodsOfClass = new ArrayList<>();
|
final List<ExecutableElement> methodsOfClass =
|
||||||
addMethods( element, methodsOfClass );
|
methodsIn( context.getElementUtils().getAllMembers(element) );
|
||||||
for ( ExecutableElement method: methodsOfClass ) {
|
for ( ExecutableElement method: methodsOfClass ) {
|
||||||
if ( containsAnnotation( method, HQL, SQL, JD_QUERY, FIND, JD_FIND ) ) {
|
if ( containsAnnotation( method, HQL, SQL, JD_QUERY, FIND, JD_FIND ) ) {
|
||||||
queryMethods.add( method );
|
queryMethods.add( method );
|
||||||
|
@ -396,8 +396,9 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
||||||
queryMethods.add( method );
|
queryMethods.add( method );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !isSessionGetter(method)
|
else if ( method.getEnclosingElement().getKind().isInterface()
|
||||||
&& !method.getModifiers().contains(Modifier.DEFAULT) ) {
|
&& !method.isDefault()
|
||||||
|
&& !isSessionGetter(method) ) {
|
||||||
final String companionClassName = element.getQualifiedName().toString() + '$';
|
final String companionClassName = element.getQualifiedName().toString() + '$';
|
||||||
if ( context.getElementUtils().getTypeElement(companionClassName) == null ) {
|
if ( context.getElementUtils().getTypeElement(companionClassName) == null ) {
|
||||||
message( method, "repository method cannot be implemented",
|
message( method, "repository method cannot be implemented",
|
||||||
|
@ -498,19 +499,6 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMethods(TypeElement element, List<ExecutableElement> methodsOfClass) {
|
|
||||||
//TODO just use Elements.getAllMembers(element) here!
|
|
||||||
for ( TypeMirror typeMirror : element.getInterfaces() ) {
|
|
||||||
final DeclaredType declaredType = (DeclaredType) typeMirror;
|
|
||||||
final TypeElement typeElement = (TypeElement) declaredType.asElement();
|
|
||||||
addMethods( typeElement, methodsOfClass );
|
|
||||||
}
|
|
||||||
for ( ExecutableElement method : methodsIn( element.getEnclosedElements() ) ) {
|
|
||||||
methodsOfClass.removeIf( m -> context.getElementUtils().overrides(method, m, element) );
|
|
||||||
methodsOfClass.add( method );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addDefaultConstructor() {
|
private void addDefaultConstructor() {
|
||||||
final String sessionVariableName = getSessionVariableName(sessionType);
|
final String sessionVariableName = getSessionVariableName(sessionType);
|
||||||
putMember("_", new DefaultConstructor(
|
putMember("_", new DefaultConstructor(
|
||||||
|
|
Loading…
Reference in New Issue