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

Commit

Permalink
#58 - Add support for @EbeanComponent (to register other types like B…
Browse files Browse the repository at this point in the history
…eanPersistController, BeanPersistListener etc)
  • Loading branch information
rbygrave committed Jun 26, 2020
1 parent c4aa14d commit 73738e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/io/ebean/querybean/generator/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Constants {
String ENTITY = "javax.persistence.Entity";
String EMBEDDABLE = "javax.persistence.Embeddable";
String CONVERTER = "javax.persistence.Converter";
String EBEAN_COMPONENT = "io.ebean.annotation.EbeanComponent";

String DBARRAY = "io.ebean.annotation.DbArray";
String DBJSON = "io.ebean.annotation.DbJson";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ TypeElement converterAnnotation() {
return elementUtils.getTypeElement(CONVERTER);
}

TypeElement componentAnnotation() {
return elementUtils.getTypeElement(EBEAN_COMPONENT);
}

private String generatedAnnotation(boolean jdk8) {
if (jdk8) {
return isTypeAvailable(GENERATED_8) ? GENERATED_8 : null;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/ebean/querybean/generator/Processor.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Set<String> getSupportedAnnotationTypes() {
annotations.add(ENTITY);
annotations.add(EMBEDDABLE);
annotations.add(CONVERTER);
annotations.add(EBEAN_COMPONENT);
annotations.add(MODULEINFO);
return annotations;
}
Expand Down Expand Up @@ -74,6 +75,9 @@ private void processOthers(RoundEnvironment roundEnv) {
for (Element element : roundEnv.getElementsAnnotatedWith(processingContext.converterAnnotation())) {
processingContext.addOther(element);
}
for (Element element : roundEnv.getElementsAnnotatedWith(processingContext.componentAnnotation())) {
processingContext.addOther(element);
}
}

private void writeModuleInfoBean() {
Expand Down

0 comments on commit 73738e9

Please sign in to comment.