示例 1:基本用法
import org.springframework.util.Assert;
public class CompanyService {
public void activateCompany(ActivateInfo activateInfo) {
Assert.hasText(activateInfo.getCompanyName(), "公司名称不能为空!");
// 其他业务逻辑
}
}
class ActivateInfo {
private String companyName;
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
}