Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 73738e9

Browse files
committed
#58 - Add support for @EbeanComponent (to register other types like BeanPersistController, BeanPersistListener etc)
1 parent c4aa14d commit 73738e9

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/java/io/ebean/querybean/generator/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface Constants {
1414
String ENTITY = "javax.persistence.Entity";
1515
String EMBEDDABLE = "javax.persistence.Embeddable";
1616
String CONVERTER = "javax.persistence.Converter";
17+
String EBEAN_COMPONENT = "io.ebean.annotation.EbeanComponent";
1718

1819
String DBARRAY = "io.ebean.annotation.DbArray";
1920
String DBJSON = "io.ebean.annotation.DbJson";

src/main/java/io/ebean/querybean/generator/ProcessingContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ TypeElement converterAnnotation() {
113113
return elementUtils.getTypeElement(CONVERTER);
114114
}
115115

116+
TypeElement componentAnnotation() {
117+
return elementUtils.getTypeElement(EBEAN_COMPONENT);
118+
}
119+
116120
private String generatedAnnotation(boolean jdk8) {
117121
if (jdk8) {
118122
return isTypeAvailable(GENERATED_8) ? GENERATED_8 : null;

src/main/java/io/ebean/querybean/generator/Processor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public Set<String> getSupportedAnnotationTypes() {
3232
annotations.add(ENTITY);
3333
annotations.add(EMBEDDABLE);
3434
annotations.add(CONVERTER);
35+
annotations.add(EBEAN_COMPONENT);
3536
annotations.add(MODULEINFO);
3637
return annotations;
3738
}
@@ -74,6 +75,9 @@ private void processOthers(RoundEnvironment roundEnv) {
7475
for (Element element : roundEnv.getElementsAnnotatedWith(processingContext.converterAnnotation())) {
7576
processingContext.addOther(element);
7677
}
78+
for (Element element : roundEnv.getElementsAnnotatedWith(processingContext.componentAnnotation())) {
79+
processingContext.addOther(element);
80+
}
7781
}
7882

7983
private void writeModuleInfoBean() {

0 commit comments

Comments
 (0)