• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IBANCheckDigit类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.commons.validator.routines.checkdigit.IBANCheckDigit的典型用法代码示例。如果您正苦于以下问题:Java IBANCheckDigit类的具体用法?Java IBANCheckDigit怎么用?Java IBANCheckDigit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IBANCheckDigit类属于org.apache.commons.validator.routines.checkdigit包,在下文中一共展示了IBANCheckDigit类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: bankAccount

点赞 3

import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; //导入依赖的package包/类
/**
 * Bank account.
 *
 * @param bankAccountForm the bank account form
 * @param errors the errors
 * @param ra the ra
 * @param model the model
 * @return the string
 */
@RequestMapping(value = "bankAccount", method = RequestMethod.POST)
public String bankAccount(@Valid @ModelAttribute BankAccountForm bankAccountForm, Errors errors, RedirectAttributes ra, Model model) {

	if (errors.hasErrors()) {
		return createProfileForm(model, new ProfileForm());
	}

	IBANCheckDigit ibanCheckDigit = new IBANCheckDigit();
	if (!ibanCheckDigit.isValid(bankAccountForm.getIban())) {
		errors.rejectValue("iban", "account.errorIban", new Object[] { bankAccountForm.getIban() }, "iban");
		return createProfileForm(model, new ProfileForm());
	}

	accountService.saveBankAccount(bankAccountForm.createBankAccount(account));
	MessageHelper.addWarningAttribute(ra, "account.successCreateBankAccount", bankAccountForm.getBank());
	return "redirect:/account";
}
 

开发者ID:pablogrela,
项目名称:members_cuacfm,
代码行数:27,
代码来源:AccountController.java

示例2: calculateIban

点赞 2

import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; //导入依赖的package包/类
private String calculateIban(String bankCode, String accountNumber) {
    try {
        String ibanWithoutCheckCode = createIban("00", bankCode, accountNumber);
        String checkSum = new IBANCheckDigit().calculate(ibanWithoutCheckCode);
        return createIban(checkSum, bankCode, accountNumber);
    } catch (CheckDigitException e) {
        throw new SimulatorException(String.format("Error calculating IBAN [code:%s,account:%s]", bankCode, accountNumber));
    }
}
 

开发者ID:christophd,
项目名称:citrus-simulator,
代码行数:10,
代码来源:BankService.java

示例3: isValid

点赞 2

import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; //导入依赖的package包/类
/**
 * Validate an IBAN Code
 *
 * @param code The value validation is being performed on
 * @return <code>true</code> if the value is valid
 */
public boolean isValid(String code) {
    Validator formatValidator = getValidator(code);
    if (formatValidator == null || code.length() != formatValidator.lengthOfIBAN || !formatValidator.validator.isValid(code)) {
        return false;
    }
    return IBANCheckDigit.IBAN_CHECK_DIGIT.isValid(code);
}
 

开发者ID:ManfredTremmel,
项目名称:gwt-commons-validator,
代码行数:14,
代码来源:IBANValidator.java

示例4: testValid

点赞 2

import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; //导入依赖的package包/类
@Test
public void testValid() {
    for(String f : validIBANFormat) {
        assertTrue("Checksum fail: "+f, IBANCheckDigit.IBAN_CHECK_DIGIT.isValid(f));
        assertTrue("Missing validator: "+f, VALIDATOR.hasValidator(f));
        assertTrue(f, VALIDATOR.isValid(f));
    }
}
 

开发者ID:ManfredTremmel,
项目名称:gwt-commons-validator,
代码行数:9,
代码来源:IBANValidatorTest.java

示例5: matches

点赞 2

import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; //导入依赖的package包/类
@Override
public boolean matches(String value) {
    if (!super.matches(value)) {
        return false;
    }
    
    value = value.replaceAll("\\s+", "");
    IBANCheckDigit validator = new IBANCheckDigit();
    return validator.isValid(value);
}
 

开发者ID:arx-deidentifier,
项目名称:arx,
代码行数:11,
代码来源:HIPAAMatcherAttributeValue.java

示例6: validateIban

点赞 2

import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; //导入依赖的package包/类
private boolean validateIban(String iban) {
    return new IBANCheckDigit().isValid(iban);
}
 

开发者ID:christophd,
项目名称:citrus-simulator,
代码行数:4,
代码来源:BankService.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)