public DriverNIF(long nif) { if (!NumberValidator.isValidNIF(nif)) { throw new BusinessRuleValidationException(nif + " invalid: Driver NIF is invalid"); } if (NumberValidator.isNegative(nif)) { throw new BusinessRuleValidationException(nif + " invalid: Driver NIF can't be negative"); } this.nif = nif; }
public CitizenCardNumber(long citizenCardNumber) { if (!NumberValidator.isValidCitizenCardNumber(citizenCardNumber)) { throw new BusinessRuleValidationException(citizenCardNumber + " invalid: Driver Citizen Card Number invalid"); } if (NumberValidator.isNegative(citizenCardNumber)) { throw new BusinessRuleValidationException(citizenCardNumber + " invalid: Driver Citizen Card Number can't be negative"); } this.citizenCardNumber = citizenCardNumber; }