objectbox-java icon indicating copy to clipboard operation
objectbox-java copied to clipboard

@BaseEntity annotation in superclass library

Open davidhowe opened this issue 5 years ago • 5 comments

I am aware that according to your documentation, @BaseEntity not allowed on a superclass from a library. I was hoping this is on the dev roadmap? Please advise. Thanks!

davidhowe avatar Sep 02 '20 12:09 davidhowe

Thanks. This is similar to multi-module support requested in #588. However, this talks about entities from dependencies. Both are currently not possible due to technical restrictions (the annotation processor can not see these classes).

greenrobot-team avatar Sep 07 '20 06:09 greenrobot-team

Thanks. This is similar to multi-module support requested in #588. However, this talks about entities from dependencies. Both are currently not possible due to technical restrictions (the annotation processor can not see these classes).

Muti-module is a popular developing way now , some libs like arouter (https://github.com/alibaba/ARouter) can do this , deal annotation for muti module. It seems that technical restrictions can break down.

showwiki avatar Jul 31 '21 04:07 showwiki

@showwiki Thanks for the link. I had a quick look at their annotation processor, but didn't see anything that might help with our use case.

greenrobot-team avatar Aug 03 '21 13:08 greenrobot-team

  1. in sub-module create router map RouteProcessor.java

  2. in main-module scan all map PluginLaunch.groovy#L36 ScanUtil.groovy#L39

  3. collect the scan results and insert them into the core class RegisterTransform.groovy#L119 LogisticsCenter.java#L65

Hope that ObjectBox can support Multi-modules. Thx~

@greenrobot-team

AifeiI avatar Dec 02 '21 08:12 AifeiI

Maybe:

  1. Generate entity metadata on sub-modules through Annotation Processor
  2. On the main module through the plug-in io.objectbox:objectbox-gradle-plugin, scan all entity metadata to generate MyBoxStore

AifeiI avatar Dec 02 '21 09:12 AifeiI