ebean-orm-tools / finder-generator

Code generator for avaje-ebeanorm-typequery
Apache License 2.0
2 stars 3 forks source link

GeneratorConfig.setLang only for Kotlin #27

Closed Ryszard-Trojnacki closed 5 years ago

Ryszard-Trojnacki commented 5 years ago

In method GeneratorConfig.setLang:

  public void setLang(String lang) {
    this.lang = lang;
    this.languageAdapter = new KotlinLangAdapter();
  }

is something wrong, because if I set "java" then KotlinLangAdapter is assigned.

I think that there should be something like isJava/isKotlin - that is enableJava/enableKotlin.

rbygrave commented 5 years ago

Well, the way finder-generator is used is via ebeaninit - https://github.com/ebean-orm-tools/ebean-init

When generating Java code it doesn't call setLang() ... it only calls setLang() when it is generating Kotlin code. Refer: https://github.com/ebean-orm-tools/ebean-init/blob/master/src/main/java/io/ebean/tools/init/action/DoGenerate.java#L92

So yes we could fix up setLang() to also support Java ... but not sure why you are not using ebeaninit? https://ebean.io/docs/getting-started/cli-tool

ebeaninit can do more now, full setup of a maven or gradle project basically. Plus ebeaninit is going to be where we do some more cool stuff like suggest code changes for queries based on profiling.

But yes, this should be fixed ...

Ryszard-Trojnacki commented 5 years ago

I don't need this function. I just spotted that it is wrong, while searching for https://github.com/ebean-orm-tools/finder-generator/issues/28.

rbygrave commented 5 years ago

Fixed by https://github.com/ebean-orm-tools/finder-generator/pull/29