Let's say I have a class with validation and I want field "number_0f_days_to_death" to be smaller than field "number_of_day_to_recovery", is there an annotation for this or any other way? Thanks in advance.
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class SimulationViewModel {
private Long id;
@NotEmpty(message = "field can not be empty")
private String simulation_Name;
@NotNull(message = "field can not be empty")
@DecimalMax("10000000000.0") @DecimalMin("0.0")
private Double population_Size;
@NotNull(message = "field can not be empty")
private Long initial_Infected_Number;
@NotNull(message = "field can not be empty")
private Double how_Many_One_Infects;
@NotNull(message = "field can not be empty")
private Double mortality_Rate;
@NotNull(message = "field can not be empty")
private Long number_Of_Days_To_Recovery;
@DecimalMin("0.0")// putting field name obviously doesn't work
@NotNull(message = "field can not be empty")
private Long number_Of_Days_To_Death;// I want this field to be smaller than
number_Of_Days_To_Recovery field
@NotNull(message = "field can not be empty")
private Long simulation_Time;
List<SimulationsValues> simulationsValues;
}