I'm back for a new question about recurrences.
I would like to create my Recurrence step by step, but I'm not able to figure out how I can do that.
For example, I initialized my Recurrence like this :
Recurrence recur = new Recurrence.Builder(Frequency.YEARLY).build();
And then I would like to give some days in "byDay", but there is no setters on the Recurrence attributes.
How can I update this data ?
The example in the quick start can't save me, could you give me a more complex one ?
I'm still in version 0.3.1.
Thanks a lot,
Perrine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Recurrence class is immutable, which is why it doesn't have setters. To populate the object with data, call the setter methods on its builder class like so:
:::java
Recurrence recur = new Recurrence.Builder(Frequency.YEARLY)
.byDay(DayOfWeek.MONDAY)
.count(5)
.build();
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Thanks a lot for you answer!
So, I have to prepare all my data before creating de final recurrence.
But there is something else I have a problem.
If I want this : "BYDAY=MO,TU,WE,TH,FR", I have to do
new Recurrence.Builder(frequency).byDay(DayOfWeek.MONDAY).byDay(DayOfWeek.THURSDAY).....build();
I would like to do something with a List or only one variable, so that I prepare ma variable before creating the object, is there any way to do that ?
I'm sorry if I ask stupid questions ;)
Thanks !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Thank you for taking my opinion into consideration, but this solution is not the one I would have expected, because it's difficult to be generic.
When I create my recurrence, I do not have necessarily the same days, so I would like to prepare a list before creating my recurrence.
Something like this for example :
List<DayOfWeek> byDays = new ArrayList<DayOfWeek>();
// some code to know what days I need and initialize my list ....
Recurrence recur = new Recurrence.Builder(frequency).byDays(byDays).build();
I don't know if I'm clear, do you understand what I mean ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm back for a new question about recurrences.
I would like to create my Recurrence step by step, but I'm not able to figure out how I can do that.
For example, I initialized my Recurrence like this :
Recurrence recur = new Recurrence.Builder(Frequency.YEARLY).build();
And then I would like to give some days in "byDay", but there is no setters on the Recurrence attributes.
How can I update this data ?
The example in the quick start can't save me, could you give me a more complex one ?
I'm still in version 0.3.1.
Thanks a lot,
Perrine.
Oops, I'm sorry, it seems there was a problem with my session...
Hi again Perrine!
The
Recurrenceclass is immutable, which is why it doesn't have setters. To populate the object with data, call the setter methods on its builder class like so:Hello,
Thanks a lot for you answer!
So, I have to prepare all my data before creating de final recurrence.
But there is something else I have a problem.
If I want this : "BYDAY=MO,TU,WE,TH,FR", I have to do
new Recurrence.Builder(frequency).byDay(DayOfWeek.MONDAY).byDay(DayOfWeek.THURSDAY).....build();
I would like to do something with a List or only one variable, so that I prepare ma variable before creating the object, is there any way to do that ?
I'm sorry if I ask stupid questions ;)
Thanks !
I did like this :
But if you have something more beautiful, why not :p
Thanks again, it is always a pleasure to work with biweekly ;)
Sure, I'll create a method that accepts a vararg of days. I can see how handy that could be! Thanks for your input, as always. ;)
Hello,
Thank you for taking my opinion into consideration, but this solution is not the one I would have expected, because it's difficult to be generic.
When I create my recurrence, I do not have necessarily the same days, so I would like to prepare a list before creating my recurrence.
Something like this for example :
I don't know if I'm clear, do you understand what I mean ?
I could create a "byDays()" method that takes a "List" as a parameter. Is that what you are suggesting?
Yes, that's it ! :)
I think it will be easier to use, but it's just an idea ;)
I agree. Thanks for the idea. :)