Java tutorial
/* * Project: guahao-portal-biz-core * * File Created at 2014-6-3 * * Copyright 2012 Greenline.com Corporation Limited. * All rights reserved. * * This software is the confidential and proprietary information of * Greenline Company. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Greenline.com. */ package com.greenline.guahao.biz.manager.insurance.validator; import org.apache.commons.lang.StringUtils; import com.greenline.common.util.RegexUtil; import com.greenline.guahao.biz.manager.common.LocalResponseDO; import com.greenline.guahao.biz.manager.common.LocalResponseDO.LocalResponseCode; import com.greenline.guahao.biz.manager.insurance.dataobject.ProposerDO; /** * @Type InsuranceValidator * @Desc ? * @author alex * @date 2014-6-3 * @Version V1.0 */ public class InsuranceValidator { public static boolean validateProposer(LocalResponseDO<Object> lrd, ProposerDO proposer) { boolean suc = false; String err = null; if (null == proposer) { err = "??"; } else if (StringUtils.isBlank(proposer.getName())) { err = "???"; } else if (StringUtils.isBlank(proposer.getIdcard())) { err = "???"; } else if (!RegexUtil.isIdCard(proposer.getIdcard().toLowerCase())) { err = "????"; } else if (StringUtils.isBlank(proposer.getMobile())) { err = "???"; } else if (!RegexUtil.isMobile(proposer.getMobile())) { err = "????"; } else if (StringUtils.isNotBlank(proposer.getEmail()) && !RegexUtil.isEmail(proposer.getEmail())) { err = "??"; } if (null != err) { lrd.setResult(LocalResponseCode.LOCAL_ERROR, err, err); } else { suc = true; } return suc; } }