Skip to content

Commit f3e254d

Browse files
committed
The missing java docs have been added
1 parent 7f89d0f commit f3e254d

17 files changed

+1259
-1
lines changed

src/main/java/annotations/ExcelBodyStyle.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,27 @@
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12+
/**
13+
* This annotation defines the style of the Excel file body when converting a list of objects to an Excel file
14+
* @author Mirko Benincasa
15+
* @since 0.1.0
16+
*/
1217
@Retention(RetentionPolicy.RUNTIME)
1318
@Target(ElementType.TYPE)
1419
public @interface ExcelBodyStyle {
1520

21+
/**
22+
* @return the background color of the cell. The default is {@code IndexedColors.GREY_25_PERCENT}
23+
*/
1624
IndexedColors cellColor() default IndexedColors.GREY_25_PERCENT;
1725

26+
/**
27+
* @return the horizontal orientation of the text in the cell. The default is {@code HorizontalAlignment.LEFT}
28+
*/
1829
HorizontalAlignment horizontal() default HorizontalAlignment.LEFT;
1930

31+
/**
32+
* @return the vertical orientation of the text in the cell. The default is {@code VerticalAlignment.TOP}
33+
*/
2034
VerticalAlignment vertical() default VerticalAlignment.TOP;
2135
}

src/main/java/annotations/ExcelField.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@
55
import java.lang.annotation.RetentionPolicy;
66
import java.lang.annotation.Target;
77

8+
/**
9+
* This annotation defines the header field of the Excel file
10+
* @author Mirko Benincasa
11+
* @since 0.1.0
12+
*/
813
@Retention(RetentionPolicy.RUNTIME)
914
@Target(ElementType.FIELD)
1015
public @interface ExcelField {
1116

17+
/**
18+
* @return the name of the field written in the header.
19+
*/
1220
String name();
1321
}

src/main/java/annotations/ExcelHeaderStyle.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,32 @@
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12+
/**
13+
* This annotation defines the header style of the Excel file when converting a list of objects to an Excel file
14+
* @author Mirko Benincasa
15+
* @since 0.1.0
16+
*/
1217
@Retention(RetentionPolicy.RUNTIME)
1318
@Target(ElementType.TYPE)
1419
public @interface ExcelHeaderStyle {
1520

21+
/**
22+
* @return the background color of the cell. The default is {@code IndexedColors.GREY_50_PERCENT}
23+
*/
1624
IndexedColors cellColor() default IndexedColors.GREY_50_PERCENT;
1725

26+
/**
27+
* @return the horizontal orientation of the text in the cell. The default is {@code HorizontalAlignment.LEFT}
28+
*/
1829
HorizontalAlignment horizontal() default HorizontalAlignment.LEFT;
1930

31+
/**
32+
* @return the vertical orientation of the text in the cell. The default is {@code VerticalAlignment.TOP}
33+
*/
2034
VerticalAlignment vertical() default VerticalAlignment.TOP;
2135

36+
/**
37+
* @return {@code true} if the autosize rules should be applied, otherwise {@code false}. The default is {@code false}
38+
*/
2239
boolean autoSize() default false;
2340
}

src/main/java/enums/Extension.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,46 @@
77
import java.util.Arrays;
88
import java.util.Optional;
99

10+
/**
11+
* This Enum defines the file extensions supported by the library.
12+
* @author Mirko Benincasa
13+
* @since 0.1.0
14+
*/
1015
@Getter
1116
@AllArgsConstructor
1217
public enum Extension {
1318

19+
/**
20+
* This extension is used for a Microsoft Office spreadsheet up to version 2003
21+
*/
1422
XLS("xls", "EXCEL"),
23+
24+
/**
25+
* This extension is used for a Microsoft Office spreadsheet from version 2007 onwards
26+
*/
1527
XLSX("xlsx", "EXCEL"),
28+
29+
/**
30+
* This extension is used for CSV (Comma-separated values) files
31+
*/
1632
CSV("csv", "CSV");
1733

34+
/**
35+
* The extension's name
36+
*/
1837
private final String ext;
38+
39+
/**
40+
* The extension's type
41+
*/
1942
private final String type;
2043

44+
/**
45+
* This method retrieves the Enum value based on the extension name provided as input
46+
* @param ext the name of an Excel file extension to search for
47+
* @return The Enum value that matches the name provided as input and is of type Excel
48+
* @throws ExtensionNotValidException if no Enum value is found
49+
*/
2150
public static Extension getExcelExtension(String ext) throws ExtensionNotValidException {
2251
Optional<Extension> extensionOptional = Arrays.stream(Extension.values()).filter(e -> ext.equalsIgnoreCase(e.getExt()) && e.getType().equals("EXCEL")).findFirst();
2352
if (extensionOptional.isEmpty()) {

src/main/java/exceptions/ExtensionNotValidException.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
11
package exceptions;
22

3+
/**
4+
* This exception signals that the extension is invalid
5+
* @author Mirko Benincasa
6+
* @since 0.1.0
7+
*/
38
public class ExtensionNotValidException extends Exception {
49

10+
/**
11+
* Constructs an {@code ExtensionNotValidException} with {@code null}
12+
* as its error detail message.
13+
*/
514
public ExtensionNotValidException() {
615
super();
716
}
817

18+
/**
19+
* Constructs an {@code ExtensionNotValidException} with the specified detail message.
20+
*
21+
* @param message
22+
* The detail message (which is saved for later retrieval
23+
* by the {@link #getMessage()} method)
24+
*/
925
public ExtensionNotValidException(String message) {
1026
super(message);
1127
}
1228

29+
/**
30+
* Constructs an {@code ExtensionNotValidException} with the specified detail message
31+
* and cause.
32+
*
33+
* <p> Note that the detail message associated with {@code cause} is
34+
* <i>not</i> automatically incorporated into this exception's detail
35+
* message.
36+
*
37+
* @param message
38+
* The detail message (which is saved for later retrieval
39+
* by the {@link #getMessage()} method)
40+
*
41+
* @param cause
42+
* The cause (which is saved for later retrieval by the
43+
* {@link #getCause()} method). (A null value is permitted,
44+
* and indicates that the cause is nonexistent or unknown.)
45+
*/
1346
public ExtensionNotValidException(String message, Throwable cause) {
1447
super(message, cause);
1548
}

src/main/java/exceptions/FileAlreadyExistsException.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
package exceptions;
22

3+
/**
4+
* This exception signals that the file already exists
5+
* @author Mirko Benincasa
6+
* @since 0.1.0
7+
*/
38
public class FileAlreadyExistsException extends Exception {
49

10+
/**
11+
* Constructs an {@code FileAlreadyExistsException} with the specified detail message.
12+
*
13+
* @param message
14+
* The detail message (which is saved for later retrieval
15+
* by the {@link #getMessage()} method)
16+
*/
517
public FileAlreadyExistsException(String message) {
618
super(message);
719
}

src/main/java/exceptions/HeaderNotPresentException.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
11
package exceptions;
22

3+
/**
4+
* This exception signals that the file header is missing
5+
* @author Mirko Benincasa
6+
* @since 0.1.0
7+
*/
38
public class HeaderNotPresentException extends Exception {
49

10+
/**
11+
* Constructs an {@code HeaderNotPresentException} with {@code null}
12+
* as its error detail message.
13+
*/
514
public HeaderNotPresentException() {
615
super();
716
}
817

18+
/**
19+
* Constructs an {@code HeaderNotPresentException} with the specified detail message.
20+
*
21+
* @param message
22+
* The detail message (which is saved for later retrieval
23+
* by the {@link #getMessage()} method)
24+
*/
925
public HeaderNotPresentException(String message) {
1026
super(message);
1127
}
1228

29+
/**
30+
* Constructs an {@code HeaderNotPresentException} with the specified detail message
31+
* and cause.
32+
*
33+
* <p> Note that the detail message associated with {@code cause} is
34+
* <i>not</i> automatically incorporated into this exception's detail
35+
* message.
36+
*
37+
* @param message
38+
* The detail message (which is saved for later retrieval
39+
* by the {@link #getMessage()} method)
40+
*
41+
* @param cause
42+
* The cause (which is saved for later retrieval by the
43+
* {@link #getCause()} method). (A null value is permitted,
44+
* and indicates that the cause is nonexistent or unknown.)
45+
*/
1346
public HeaderNotPresentException(String message, Throwable cause) {
1447
super(message, cause);
1548
}

src/main/java/exceptions/OpenWorkbookException.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
11
package exceptions;
22

3+
/**
4+
* This exception signals that an error occurred while opening an Excel file workbook
5+
* @author Mirko Benincasa
6+
* @since 0.1.0
7+
*/
38
public class OpenWorkbookException extends Exception {
49

10+
/**
11+
* Constructs an {@code OpenWorkbookException} with {@code null}
12+
* as its error detail message.
13+
*/
514
public OpenWorkbookException() {
615
super();
716
}
817

18+
/**
19+
* Constructs an {@code OpenWorkbookException} with the specified detail message.
20+
*
21+
* @param message
22+
* The detail message (which is saved for later retrieval
23+
* by the {@link #getMessage()} method)
24+
*/
925
public OpenWorkbookException(String message) {
1026
super(message);
1127
}
1228

29+
/**
30+
* Constructs an {@code OpenWorkbookException} with the specified detail message
31+
* and cause.
32+
*
33+
* <p> Note that the detail message associated with {@code cause} is
34+
* <i>not</i> automatically incorporated into this exception's detail
35+
* message.
36+
*
37+
* @param message
38+
* The detail message (which is saved for later retrieval
39+
* by the {@link #getMessage()} method)
40+
*
41+
* @param cause
42+
* The cause (which is saved for later retrieval by the
43+
* {@link #getCause()} method). (A null value is permitted,
44+
* and indicates that the cause is nonexistent or unknown.)
45+
*/
1346
public OpenWorkbookException(String message, Throwable cause) {
1447
super(message, cause);
1548
}

src/main/java/exceptions/SheetNotFoundException.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
package exceptions;
22

3+
/**
4+
* This exception signals that the Excel sheet was not found
5+
* @author Mirko Benincasa
6+
* @since 0.1.0
7+
*/
38
public class SheetNotFoundException extends Exception {
49

10+
/**
11+
* Constructs an {@code SheetNotFoundException} with {@code null}
12+
* as its error detail message.
13+
*/
514
public SheetNotFoundException() {
615
super();
716
}
817

18+
/**
19+
* Constructs an {@code SheetNotFoundException} with the specified detail message.
20+
*
21+
* @param message
22+
* The detail message (which is saved for later retrieval
23+
* by the {@link #getMessage()} method)
24+
*/
925
public SheetNotFoundException(String message) {
1026
super(message);
1127
}

0 commit comments

Comments
 (0)