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

Create any IntentBuilder to avoid generation of methods #8

Closed
Kolyall opened this issue Apr 6, 2017 · 6 comments
Closed

Create any IntentBuilder to avoid generation of methods #8

Kolyall opened this issue Apr 6, 2017 · 6 comments

Comments

@Kolyall
Copy link

Kolyall commented Apr 6, 2017

for example in activity:

    @Arg @Optional String text;
    @Arg @Optional Lond id;
    @Arg @Optional Boolean success;

sometimes is needed two of this variables, so how to create intent for two values?
you added to 0.50 generation of the methods but you can make this:

Intent intent = MusicPlayerActivityStarter.getIntentBuilder(context).text(text).id(id).build();
@MarcinMoskala
Copy link
Owner

I was thinking about it, but this is an idea for different library. Making two ways to do the same thing is not a good idea. Also, it would make compilation slower and lead to much more generated methods.

@Kolyall
Copy link
Author

Kolyall commented Apr 6, 2017

"different library"
where is this library?
I think that generate methods for each variable and for each pair of variable is too much for RAM...
and Builder is more useful and understandable

@MarcinMoskala
Copy link
Owner

There must be a way to inform developer which elements are optional and which must be provided. To prevent from starting Activity without non-optional arguments. If you do it in the binder then you will have much more code generated then in here.

@Kolyall
Copy link
Author

Kolyall commented Apr 8, 2017

    @Arg String text1;
    @Arg @Optional String text2;
    @Arg String text3;
    @Arg @Optional Lond id;
    @Arg @Optional Boolean success;

can't be this implemented?

Intent intent = MusicPlayerActivityStarter.getIntentBuilder(context,text1,text3).text(text2).id(id).success(success).build();

Also you can add a value to annotation : @MakeActivityStarter(include = INTENT_BUILDER)

@thats-bot
Copy link

@MarcinMoskala

I was thinking about it, but this is an idea for different library.

But how to use this one with mixed args (optional and required)?

@MarcinMoskala
Copy link
Owner

https://github.com/MarcinMoskala/ActivityStarter/wiki/Optional-annotation

There are generated function for each variant. Here is example of function and what is generates as a result:

https://github.com/MarcinMoskala/ActivityStarter/blob/master/generationExamples/fragment/MultipleOptional

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

3 participants