diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/InvalidPeselException.java b/src/main/java/io/github/viepovsky/polishutils/pesel/InvalidPeselException.java index 32f10ec..55663f0 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/InvalidPeselException.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/InvalidPeselException.java @@ -11,11 +11,12 @@ * */ public class InvalidPeselException extends RuntimeException { + /** * Constructs a {@code InvalidPeselException} with the specified * detail message. * - * @param message the detail message. + * @param message the detail message. */ InvalidPeselException(String message) { super(message); diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/Pesel.java b/src/main/java/io/github/viepovsky/polishutils/pesel/Pesel.java index 6e4e230..d846c82 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/Pesel.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/Pesel.java @@ -18,7 +18,7 @@ *
- * and then you can access the PESEL values: + * and then you can access the PESEL values: ** Pesel pesel = new Pesel("92082683499"); *
* String gender = pesel.getGender(); * LocalDate birthDate = pesel.getBirthDate(); @@ -31,10 +31,12 @@ * @author Oskar Rajzner */ public class Pesel extends PeselDigits { + /** * The date of birth decoded from the given PESEL. */ private final LocalDate birthDate; + /** * The gender decoded from the given PESEL. */ @@ -56,7 +58,7 @@ public Pesel(String pesel) { * Validates given PESEL, decodes and stores date of birth, gender and sets PESEL digits. * * @param peselDecoder an instance of the {@code PeselDecoder} class - * @param pesel the PESEL number + * @param pesel the PESEL number * @throws InvalidPeselException if the given PESEL is invalid */ private Pesel(PeselDecoder peselDecoder, String pesel) { @@ -81,6 +83,7 @@ private Pesel(PeselDecoder peselDecoder, String pesel) { public String getGender() { return String.valueOf(gender); } + /** * Returns decoded date of birth of given PESEL number. * diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDecoder.java b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDecoder.java index b892ebd..c9c6949 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDecoder.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDecoder.java @@ -10,8 +10,10 @@ * @author Oskar Rajzner */ final class PeselDecoder { + /** * Decodes the date of birth from given PESEL. + * * @param pesel the PESEL number * @return the date of birth as a LocalDate object */ @@ -46,6 +48,7 @@ LocalDate decodeBirthDate(String pesel) { /** * Decodes the gender from given PESEL. + * * @param pesel the PESEL number * @return the gender as a Pesel.Gender enum */ diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDigits.java b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDigits.java index 106ca3d..430f2e7 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDigits.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselDigits.java @@ -11,18 +11,22 @@ * @author Oskar Rajzner */ abstract class PeselDigits { + /** * Year, month, and day digits of the PESEL number in form of YYMMDD (digits 1-6). */ private int birthDateDigits; + /** * Unique serial digits of the PESEL in form of ZZZ (digits 7-9). */ private int serialDigits; + /** * Gender digit of the PESEL in form of X (digit 10). */ private int genderDigit; + /** * Control sum digit of the PESEL in form of Q (digit 11). */ diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGenerator.java b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGenerator.java index 977c80a..cbb5191 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGenerator.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGenerator.java @@ -38,22 +38,27 @@ * @see PeselGeneratorParams */ public class PeselGenerator { + /** * Digits weights for calculating the control digit of the PESEL. */ private static final int[] CONTROL_WEIGHTS = new int[]{1, 3, 7, 9, 1, 3, 7, 9, 1, 3}; + /** * A random number generator used for generating PESEL numbers. */ private static final Random RANDOM = new Random(); + /** * The gender that will be included in the generated PESEL numbers. */ private static PeselGeneratorParams.Gender gender; + /** * The minimum date range from which a PESEL number will be generated. */ private final LocalDate minDate; + /** * The maximum date range to which a PESEL number will be generated. */ @@ -181,7 +186,6 @@ private static String getRandomSerialDigits() { return String.valueOf(RANDOM.nextInt(10)) + RANDOM.nextInt(10) + RANDOM.nextInt(10); } - /** * Generates a random digit to represent the gender in the PESEL number. If a gender is specified, * the PESEL will be generated with that gender. If no gender is specified, the generated gender will be random. diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGeneratorParams.java b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGeneratorParams.java index 98e3486..944dddb 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGeneratorParams.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselGeneratorParams.java @@ -31,37 +31,43 @@ * @see PeselGenerator */ public class PeselGeneratorParams { + /** * The earliest possible date from which a PESEL number can be generated. */ private static final LocalDate MIN_DATE_POSSIBLE = LocalDate.of(1800, 1, 1); + /** * The latest possible date to which a PESEL number can be generated. */ private static final LocalDate MAX_DATE_POSSIBLE = LocalDate.of(2299, 12, 31); + /** * The default earliest date from which a PESEL number can be generated, * which is 100 years before the current date. */ private static final LocalDate DEFAULT_MIN_DATE = LocalDate.now().minusYears(100); + /** * The default latest date to which a PESEL number can be generated, which is the current date. */ private static final LocalDate DEFAULT_MAX_DATE = LocalDate.now(); + /** * The gender that will be included in the generated PESEL numbers. */ private final Gender gender; + /** * The earliest date from which a PESEL number will be generated. */ private LocalDate minDate; + /** * The latest date to which a PESEL number will be generated. */ private LocalDate maxDate; - /** * Constructs a new PeselGeneratorParams object using the Builder pattern. * It validates input dates values. diff --git a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselValidator.java b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselValidator.java index e832776..eed6e57 100644 --- a/src/main/java/io/github/viepovsky/polishutils/pesel/PeselValidator.java +++ b/src/main/java/io/github/viepovsky/polishutils/pesel/PeselValidator.java @@ -18,10 +18,12 @@ * @author Oskar Rajzner */ public abstract class PeselValidator { + /** * Digits weight for checking the validity of the PESEL */ private static final int[] CONTROL_WEIGHTS = new int[]{1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1}; + /** * An instance of the {@code PeselDecoder} class. */