使用@Builder Lombok的超类字段

时间:2019-02-06 12:40:10

标签: spring-boot lombok

如何在构建器中获取超类字段?

父母:

type GetUser = (dbUser: DbUser | null) => GqlUser | null; 
const getUser: GetUser = (dbUser) => {
  if(!dbUser) return null;
  return ... //gql user
};

const dbUser = { ... some fields} //not null for sure
getUser(dbUser) //here I want typescript to know that the result will not be null

孩子:

package com.goomo.sso.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


@AllArgsConstructor
@NoArgsConstructor
@Data
public class BaseResponseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    private String status;
    private StatusMessage statusMessage;
}

我无法在构建器中获取父类的字段。您能建议我实现该目标的正确方法吗?

0 个答案:

没有答案