Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with https://immutables.github.io/ #27

Open
anton-tregubov opened this issue Apr 1, 2017 · 5 comments
Open

Integration with https://immutables.github.io/ #27

anton-tregubov opened this issue Apr 1, 2017 · 5 comments

Comments

@anton-tregubov
Copy link

anton-tregubov commented Apr 1, 2017

I think that https://immutables.github.io/ is greatest tool for generating PoJo. Your tool can let developers (lazy developers) focus on effectve test instead of "near support" code.

I look at your sources? and see that you filter

private static Stream<Element> asFields(Element element) {
        switch (element.getKind()) {
            case FIELD:
                return Stream.of(element);
            case CLASS:
                return element.getEnclosedElements().stream().flatMap(MatcherFactoryGenerator::asFields);
        }
        return Stream.empty();
    }

and

ru.yandex.qatools.processors.matcher.gen.processing.MethodsCollector#asMethodSpec

can take into accoount method (because immutables require to define only methods).

I think i can do it too, but later...

@lanwen
Copy link
Contributor

lanwen commented Apr 2, 2017

Yes, I've been thinking a lot about using methods too, but it contains some corner cases we should usually be prepared. So I've put it to the backlog without a deadline. But maybe it's time to start progress on it :)

So if I will start it, I'll write about it here (but I should find some time only after next weekend)

@anton-tregubov
Copy link
Author

anton-tregubov commented Apr 23, 2017

Start working on feature. (my-fork)
Can you give some ideas for

some corner cases

because i change some lines and generator work fine for my cases

@lanwen
Copy link
Contributor

lanwen commented Apr 24, 2017

Should generate

  • methods from the parent (if not overridden, with annotation)

Should NOT generate for

  • methods from the parent (if overridden, without annotation)
  • static methods
  • non-public methods
  • when using both on a field with getter and on getter (should choose only one)
  • for void methods
  • for methods returning the same class (in most cases it's like the fluent setters for some predefined values)
  • for methods with args (or we should provide an ability to pass args to it, which can be quite complicated for such small library)

(maybe more, but can't remember at this time)

Thanks a lot for your time!

@anton-tregubov
Copy link
Author

anton-tregubov commented Apr 24, 2017

Если напрягает говорить на родном, скажи, я переведу.
Я понял почему я не видел проблем. Я хочу сделать гораздо проще. Добавить поиск методов которые соответствуют BeanProperty понятию. Тоесть get/isXXX свойяствам и не совпадают с публичными полями. Задача сильно упрощается.

Единственный кейз который я действительно забыл учесть - это наследование, но думаю я сделаю и это

@lanwen
Copy link
Contributor

lanwen commented Apr 24, 2017

Супер тогда. с такими ограничениями действительно будет проще. Спасибо

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants