This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/io/ebean/querybean/generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 <parent >
1010 <groupId >org.avaje</groupId >
1111 <artifactId >java8-parent</artifactId >
12- <version >1.3 </version >
12+ <version >1.4 </version >
1313 </parent >
1414
1515 <scm >
Original file line number Diff line number Diff line change 44import javax .lang .model .element .AnnotationValue ;
55import javax .lang .model .element .ExecutableElement ;
66import javax .lang .model .element .TypeElement ;
7+ import javax .lang .model .type .TypeKind ;
8+ import javax .lang .model .type .TypeMirror ;
9+ import javax .lang .model .util .Types ;
710import java .util .List ;
811import java .util .Map ;
912import java .util .Set ;
@@ -15,13 +18,18 @@ class FindDbName {
1518 /**
1619 * Return the value of the DbName annotation or null if it isn't found on the element.
1720 */
18- static String value (TypeElement element ) {
21+ static String value (TypeElement element , Types typeUtils ) {
1922
2023 AnnotationMirror mirror = findDbNameMirror (element );
2124 if (mirror != null ) {
2225 return readDbNameValue (mirror );
2326 }
24- return null ;
27+ final TypeMirror typeMirror = element .getSuperclass ();
28+ if (typeMirror .getKind () == TypeKind .NONE ) {
29+ return null ;
30+ }
31+ final TypeElement element1 = (TypeElement )typeUtils .asElement (typeMirror );
32+ return value (element1 , typeUtils );
2533 }
2634
2735 private static String readDbNameValue (AnnotationMirror mirror ) {
Original file line number Diff line number Diff line change @@ -139,6 +139,13 @@ boolean isEntity(Element element) {
139139 return hasAnnotations (element , ENTITY );
140140 }
141141
142+ /**
143+ * Find the DbName annotation and return name if found.
144+ */
145+ String findDbName (TypeElement element ) {
146+ return FindDbName .value (element , typeUtils );
147+ }
148+
142149 /**
143150 * Return true if it is a DbJson field.
144151 */
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ class SimpleQueryBeanWriter {
5959 }
6060
6161 private String findDbName () {
62- return FindDbName . value (element );
62+ return processingContext . findDbName (element );
6363 }
6464
6565 private boolean isEntity () {
You can’t perform that action at this time.
0 commit comments