Does the @Calculation annotation support Java code? For example, does the next code work?
LocalDate startDate;
@Calculation("startDate.plusDays(400)")
LocalDate endDate;
Otherwise, how can I implement the above case?
Does the @Calculation annotation support Java code? For example, does the next code work?
LocalDate startDate;
@Calculation("startDate.plusDays(400)")
LocalDate endDate;
Otherwise, how can I implement the above case?
In @Calculation you can only use basic arithmetic expressions. If you want to use Java, create a calculated property, that is, just define a getter without field and setter, like this:
@Depends("startDate")
public LocalDate getEndDate() {
return startDate.plusDay(400);
}
Note the @Depends("startDate") in order endDate would be recalculated in UI when startDate changes.