📜  java stop convert null to boolean false - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:49.702000             🧑  作者: Mango

代码示例1
public class Produto{
      private Boolean promocao;
  
    public Boolean isPromocao() {
        if (promocao instanceof Boolean) {
            return promocao;
        } else {
            return null;
        }
    }

    public void setPromocao(Boolean promocao) {
        if (promocao instanceof Boolean) {
            this.promocao = promocao;
        } else {
            return;
        }
    }
}