在下面的代码中,对函数内的布尔值 modifyPerson 所做的更改是否会保持不变,或者每次调用新函数时都会更改为其初始值。
另外我想知道如果我使用原始 boolean modifyPerson 而不是 Boolean 有什么区别。
public void validatePersonDTO(PersonDTO personDTO, TransactionLogDTO logDTO,ArrayList regionIdList,Boolean modifyPerson) {
try {
validateEffectiveIn(personDTO, logDTO,modifyPerson);
validateCdsId(personDTO, logDTO,regionIdList,modifyPerson);
validateEmpFirstName(personDTO, logDTO);
validateEmpLastName(personDTO, logDTO);
validateFinDept(personDTO, logDTO,modifyPerson);
validateEmployeeClass(personDTO, logDTO,modifyPerson);
validateWorkLoadandBudgetFTE(personDTO, logDTO,modifyPerson);
validateStatusandDescription(personDTO, logDTO,modifyPerson);
validateSalGrade(personDTO, logDTO);
validateCostRate(personDTO, logDTO);
validateJobCode(personDTO, logDTO,modifyPerson);
validateRateCardCharged(personDTO, logDTO);
validateSupervisorId(personDTO, logDTO);
}catch (Exception e) {
logDTO.setGyr("R");
logDTO.setMessage(logDTO.getMessage()+";"+"PersonDTO could not be validated");
//LOGGER.error("personDTO could not be validated: " + personDTO, e);
}
}
protected void validateEffectiveIn(PersonDTO personDTO, TransactionLogDTO logDTO,boolean modifyPerson) throws Exception{
todaysDate=convStringToDate(now(),Constants.DATE_PATTERN_LONG);
if(effIn.after(todaysDate)){
modifyPerson=true;
logDTO.setGyr("R");
logDTO.setMessage(logDTO.getMessage()+";"+"Error in Effective In date "+effIn.toString()+"cannot be greater than today’s date");
throw new Exception ("Error in Effective In date "+effIn.toString()+"cannot be greater than today’s date");
}
else{
modifyPerson=false;
}
}