Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix javadoc multiple throws tags #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/org/iban4j/Bic.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ private Bic(final String value) {
*
* @param bic the String to be parsed.
* @return a Bic object holding the value represented by the string argument.
* @throws BicFormatException if the String doesn't contain parsable Bic.
* UnsupportedCountryException if bic's country is not supported.
* @throws BicFormatException if the String doesn't contain parsable Bic.
* @throws UnsupportedCountryException if bic's country is not supported.
*/
public static Bic valueOf(final String bic) throws BicFormatException,
UnsupportedCountryException {
Expand Down Expand Up @@ -76,7 +76,7 @@ public String getLocationCode() {
* @return string representation of Bic's branch code, null if Bic has no branch code.
*/
public String getBranchCode() {
if(BicUtil.hasBranchCode(value)) {
if (BicUtil.hasBranchCode(value)) {
return BicUtil.getBranchCode(value);
}
return null;
Expand All @@ -85,7 +85,7 @@ public String getBranchCode() {
@Override
public boolean equals(final Object obj) {
if (obj instanceof Bic) {
return value.equals(((Bic)obj).value);
return value.equals(((Bic) obj).value);
}
return false;
}
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/org/iban4j/BicUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class BicUtil {
* Validates bic.
*
* @param bic to be validated.
* @throws BicFormatException if bic is invalid.
* UnsupportedCountryException if bic's country is not supported.
* @throws BicFormatException if bic is invalid.
* @throws UnsupportedCountryException if bic's country is not supported.
*/
public static void validate(final String bic) throws BicFormatException,
UnsupportedCountryException {
Expand All @@ -51,7 +51,7 @@ public static void validate(final String bic) throws BicFormatException,
validateCountryCode(bic);
validateLocationCode(bic);

if(hasBranchCode(bic)) {
if (hasBranchCode(bic)) {
validateBranchCode(bic);
}
} catch (UnsupportedCountryException e) {
Expand All @@ -62,36 +62,36 @@ public static void validate(final String bic) throws BicFormatException,
}

private static void validateEmpty(final String bic) {
if(bic == null) {
if (bic == null) {
throw new BicFormatException(BIC_NOT_NULL,
"Null can't be a valid Bic.");
}

if(bic.length() == 0) {
if (bic.length() == 0) {
throw new BicFormatException(BIC_NOT_EMPTY,
"Empty string can't be a valid Bic.");
}
}

private static void validateLength(final String bic) {
if(bic.length() != BIC8_LENGTH && bic.length() != BIC11_LENGTH) {
if (bic.length() != BIC8_LENGTH && bic.length() != BIC11_LENGTH) {
throw new BicFormatException(BIC_LENGTH_8_OR_11,
String.format("Bic length must be %d or %d",
BIC8_LENGTH, BIC11_LENGTH));
}
}

private static void validateCase(final String bic) {
if(!bic.equals(bic.toUpperCase())) {
if (!bic.equals(bic.toUpperCase())) {
throw new BicFormatException(BIC_ONLY_UPPER_CASE_LETTERS,
"Bic must contain only upper case letters.");
}
}

private static void validateBankCode(final String bic) {
String bankCode = getBankCode(bic);
for(final char ch : bankCode.toCharArray()) {
if(!Character.isLetter(ch)) {
for (final char ch : bankCode.toCharArray()) {
if (!Character.isLetter(ch)) {
throw new BicFormatException(BANK_CODE_ONLY_LETTERS, ch,
"Bank code must contain only letters.");
}
Expand All @@ -100,7 +100,7 @@ private static void validateBankCode(final String bic) {

private static void validateCountryCode(final String bic) {
final String countryCode = getCountryCode(bic);
if(countryCode.trim().length() < COUNTRY_CODE_LENGTH ||
if (countryCode.trim().length() < COUNTRY_CODE_LENGTH ||
!countryCode.equals(countryCode.toUpperCase()) ||
!Character.isLetter(countryCode.charAt(0)) ||
!Character.isLetter(countryCode.charAt(1))) {
Expand All @@ -109,16 +109,16 @@ private static void validateCountryCode(final String bic) {
"Bic country code must contain upper case letters");
}

if(CountryCode.getByCode(countryCode) == null) {
if (CountryCode.getByCode(countryCode) == null) {
throw new UnsupportedCountryException(countryCode,
"Country code is not supported.");
}
}

private static void validateLocationCode(final String bic) {
final String locationCode = getLocationCode(bic);
for(char ch : locationCode.toCharArray()) {
if(!Character.isLetterOrDigit(ch)) {
for (char ch : locationCode.toCharArray()) {
if (!Character.isLetterOrDigit(ch)) {
throw new BicFormatException(LOCATION_CODE_ONLY_LETTERS_OR_DIGITS,
ch, "Location code must contain only letters or digits.");
}
Expand All @@ -127,8 +127,8 @@ private static void validateLocationCode(final String bic) {

private static void validateBranchCode(final String bic) {
final String branchCode = getBranchCode(bic);
for(final char ch : branchCode.toCharArray()) {
if(!Character.isLetterOrDigit(ch)) {
for (final char ch : branchCode.toCharArray()) {
if (!Character.isLetterOrDigit(ch)) {
throw new BicFormatException(BRANCH_CODE_ONLY_LETTERS_OR_DIGITS,
ch, "Branch code must contain only letters or digits.");
}
Expand Down
45 changes: 21 additions & 24 deletions src/main/java/org/iban4j/Iban.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ public String getBban() {
*
* @param iban the String to be parsed.
* @return an Iban object holding the value represented by the string argument.
* @throws IbanFormatException if the String doesn't contain parsable Iban
* InvalidCheckDigitException if Iban has invalid check digit
* UnsupportedCountryException if Iban's Country is not supported.
*
* @throws IbanFormatException if the String doesn't contain parsable Iban
* @throws InvalidCheckDigitException if Iban has invalid check digit
* @throws UnsupportedCountryException if Iban's Country is not supported.
*/
public static Iban valueOf(final String iban) throws IbanFormatException,
InvalidCheckDigitException, UnsupportedCountryException {
Expand All @@ -154,21 +153,20 @@ public static Iban valueOf(final String iban) throws IbanFormatException,
/**
* Returns an Iban object holding the value of the specified String.
*
* @param iban the String to be parsed.
* @param iban the String to be parsed.
* @param format the format of the Iban.
* @return an Iban object holding the value represented by the string argument.
* @throws IbanFormatException if the String doesn't contain parsable Iban
* InvalidCheckDigitException if Iban has invalid check digit
* UnsupportedCountryException if Iban's Country is not supported.
*
* @throws IbanFormatException if the String doesn't contain parsable Iban
* @throws InvalidCheckDigitException if Iban has invalid check digit
* @throws UnsupportedCountryException if Iban's Country is not supported.
*/
public static Iban valueOf(final String iban, final IbanFormat format) throws IbanFormatException,
InvalidCheckDigitException, UnsupportedCountryException {
switch (format) {
case Default:
final String ibanWithoutSpaces = iban.replace(" ", "");
final Iban ibanObj = valueOf(ibanWithoutSpaces);
if(ibanObj.toFormattedString().equals(iban)) {
if (ibanObj.toFormattedString().equals(iban)) {
return ibanObj;
}
throw new IbanFormatException(IBAN_FORMATTING,
Expand Down Expand Up @@ -204,7 +202,7 @@ public static Iban random(CountryCode cc) {
@Override
public boolean equals(final Object obj) {
if (obj instanceof Iban) {
return value.equals(((Iban)obj).value);
return value.equals(((Iban) obj).value);
}
return false;
}
Expand Down Expand Up @@ -328,9 +326,9 @@ public Builder identificationNumber(final String identificationNumber) {
* Builds new iban instance. This methods validates the generated IBAN.
*
* @return new iban instance.
* @exception IbanFormatException if values are not parsable by Iban Specification
* <a href="http://en.wikipedia.org/wiki/ISO_13616">ISO_13616</a>
* @exception UnsupportedCountryException if country is not supported
* @throws IbanFormatException if values are not parsable by Iban Specification
* <a href="http://en.wikipedia.org/wiki/ISO_13616">ISO_13616</a>
* @throws UnsupportedCountryException if country is not supported
*/
public Iban build() throws IbanFormatException,
IllegalArgumentException, UnsupportedCountryException {
Expand All @@ -341,11 +339,11 @@ public Iban build() throws IbanFormatException,
* Builds new iban instance.
*
* @param validate boolean indicates if the generated IBAN needs to be
* validated after generation
* validated after generation
* @return new iban instance.
* @exception IbanFormatException if values are not parsable by Iban Specification
* <a href="http://en.wikipedia.org/wiki/ISO_13616">ISO_13616</a>
* @exception UnsupportedCountryException if country is not supported
* @throws IbanFormatException if values are not parsable by Iban Specification
* <a href="http://en.wikipedia.org/wiki/ISO_13616">ISO_13616</a>
* @throws UnsupportedCountryException if country is not supported
*/
public Iban build(boolean validate) throws IbanFormatException,
IllegalArgumentException, UnsupportedCountryException {
Expand All @@ -371,10 +369,9 @@ public Iban build(boolean validate) throws IbanFormatException,
* Builds random iban instance.
*
* @return random iban instance.
* @exception IbanFormatException if values are not parsable by Iban Specification
* <a href="http://en.wikipedia.org/wiki/ISO_13616">ISO_13616</a>
* @exception UnsupportedCountryException if country is not supported
*
* @throws IbanFormatException if values are not parsable by Iban Specification
* <a href="http://en.wikipedia.org/wiki/ISO_13616">ISO_13616</a>
* @throws UnsupportedCountryException if country is not supported
*/
public Iban buildRandom() throws IbanFormatException,
IllegalArgumentException, UnsupportedCountryException {
Expand All @@ -398,7 +395,7 @@ private String formatBban() {
"Country code is not supported.");
}

for(final BbanStructureEntry entry : structure.getEntries()) {
for (final BbanStructureEntry entry : structure.getEntries()) {
switch (entry.getEntryType()) {
case bank_code:
sb.append(bankCode);
Expand Down Expand Up @@ -465,7 +462,7 @@ private void fillMissingFieldsRandomly() {
"Country code is not supported.");
}

for(final BbanStructureEntry entry : structure.getEntries()) {
for (final BbanStructureEntry entry : structure.getEntries()) {
switch (entry.getEntryType()) {
case bank_code:
if (bankCode == null) {
Expand Down
Loading