How to use vaadin binder when dto's consist of nested dtos in vaadin 23

157 Views Asked by At
@AllArgsConstructor
@NoArgsConstructor
@Data
public class JobDto {
    private Long JobId;
    private String jobName;
    private String jobDesc;
    private String status;
    private boolean isScheduled;
    private String cronExpression;
    private InputSourceDto inputSource;
    private OutputSourceDto outputSource;
}
        jobBinder.bind(jobName, JobDto::getJobName, JobDto::setJobName);
        jobBinder.bind(jobDesc, JobDto::getJobDesc, JobDto::setJobDesc);
        jobBinder.forField(jobType).bind(job -> job.getOutputSource().getType(),(job,jobType) -> job.getOutputSource().setType(jobType));
        jobBinder.forField(dbUrl).bind(job -> job.getOutputSource().getConnection().getDbUrl(),(job,dbUrl) -> job.getOutputSource().getConnection().setDbUrl(dbUrl));
        jobBinder.forField(dbUserName).bind(job -> job.getOutputSource().getConnection().getDbUserName(),(job,dbUserName) -> job.getOutputSource().getConnection().setDbUserName(dbUserName));
        jobBinder.forField(dbUserPassword).bind(job -> job.getOutputSource().getConnection().getDbUserPassword(),(job,dbUserPassword) -> job.getOutputSource().getConnection().setDbUserPassword(dbUserPassword));
        jobBinder.forField(dbDriverClass).bind(job -> job.getOutputSource().getConnection().getDbDriverClass(),(job,dbDriverClass) -> job.getOutputSource().getConnection().setDbDriverClass(dbDriverClass));
        etCronExpression, JobDto ::setCronExpression);
     

my binder worked perfectly when I connected directly with the entity classes directly. Now after using the dtos it gives me a null pointer error when I try to get a nested attribute

I want to know solutions when using vaadin binder with nested dtos

0

There are 0 best solutions below