Skip to content

Commit 9214158

Browse files
committed
update javadoc
1 parent b93cc82 commit 9214158

28 files changed

Lines changed: 802 additions & 54 deletions

rlib-logger-api/src/main/java/javasabr/rlib/logger/api/Logger.java

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,95 +4,180 @@
44
import org.jspecify.annotations.NullUnmarked;
55

66
/**
7-
* @author JavaSaBr
7+
* Logger interface for outputting messages at different log levels.
8+
*
9+
* @since 10.0.0
810
*/
911
@NullUnmarked
1012
public interface Logger {
1113

14+
/**
15+
* Factory for creating log messages with no arguments.
16+
*
17+
* @since 10.0.0
18+
*/
1219
@FunctionalInterface
1320
interface Factory {
1421

1522
@NonNull
1623
String make();
1724
}
1825

26+
/**
27+
* Factory for creating log messages with one argument.
28+
*
29+
* @param <A> the type of the argument
30+
* @since 10.0.0
31+
*/
1932
@FunctionalInterface
2033
interface N1Factory<A> {
2134

2235
@NonNull
2336
String make(A arg1);
2437
}
2538

39+
/**
40+
* Factory for creating log messages with one int argument.
41+
*
42+
* @since 10.0.0
43+
*/
2644
@FunctionalInterface
2745
interface IntFactory {
2846

2947
@NonNull
3048
String make(int arg1);
3149
}
3250

51+
/**
52+
* Factory for creating log messages with an int and an object argument.
53+
*
54+
* @param <B> the type of the object argument
55+
* @since 10.0.0
56+
*/
3357
@FunctionalInterface
3458
interface IntN1Factory<B> {
3559

3660
@NonNull
3761
String make(int arg1, B arg2);
3862
}
3963

64+
/**
65+
* Factory for creating log messages with two arguments.
66+
*
67+
* @param <A> the type of the first argument
68+
* @param <B> the type of the second argument
69+
* @since 10.0.0
70+
*/
4071
@FunctionalInterface
4172
interface N2Factory<A, B> {
4273

4374
@NonNull
4475
String make(A arg1, B arg2);
4576
}
4677

78+
/**
79+
* Factory for creating log messages with an object and an int argument.
80+
*
81+
* @param <A> the type of the object argument
82+
* @since 10.0.0
83+
*/
4784
@FunctionalInterface
4885
interface N1IntFactory<A> {
4986

5087
@NonNull
5188
String make(A arg1, int arg2);
5289
}
5390

91+
/**
92+
* Factory for creating log messages with an object and two int arguments.
93+
*
94+
* @param <A> the type of the object argument
95+
* @since 10.0.0
96+
*/
5497
@FunctionalInterface
5598
interface N1Int2Factory<A> {
5699

57100
@NonNull
58101
String make(A arg1, int arg2, int arg3);
59102
}
60103

104+
/**
105+
* Factory for creating log messages with an object, an int, and another object argument.
106+
*
107+
* @param <A> the type of the first object argument
108+
* @param <C> the type of the second object argument
109+
* @since 10.0.0
110+
*/
61111
@FunctionalInterface
62112
interface N1IntN1Factory<A, C> {
63113

64114
@NonNull
65115
String make(A arg1, int arg2, C arg3);
66116
}
67117

118+
/**
119+
* Factory for creating log messages with two int arguments.
120+
*
121+
* @since 10.0.0
122+
*/
68123
@FunctionalInterface
69124
interface Int2Factory {
70125

71126
@NonNull
72127
String make(int arg1, int arg2);
73128
}
74129

130+
/**
131+
* Factory for creating log messages with three arguments.
132+
*
133+
* @param <A> the type of the first argument
134+
* @param <B> the type of the second argument
135+
* @param <C> the type of the third argument
136+
* @since 10.0.0
137+
*/
75138
@FunctionalInterface
76139
interface N3Factory<A, B, C> {
77140

78141
@NonNull
79142
String make(A arg1, B arg2, C arg3);
80143
}
81144

145+
/**
146+
* Factory for creating log messages with two int and one object argument.
147+
*
148+
* @param <C> the type of the object argument
149+
* @since 10.0.0
150+
*/
82151
@FunctionalInterface
83152
interface Int2N1Factory<C> {
84153

85154
@NonNull
86155
String make(int arg1, int arg2, C arg3);
87156
}
88157

158+
/**
159+
* Factory for creating log messages with an object, two ints, and another object argument.
160+
*
161+
* @param <A> the type of the first object argument
162+
* @param <D> the type of the second object argument
163+
* @since 10.0.0
164+
*/
89165
@FunctionalInterface
90166
interface N1Int2N1Factory<A, D> {
91167

92168
@NonNull
93169
String make(A arg1, int arg2, int arg3, D arg4);
94170
}
95171

172+
/**
173+
* Factory for creating log messages with four arguments.
174+
*
175+
* @param <A> the type of the first argument
176+
* @param <B> the type of the second argument
177+
* @param <C> the type of the third argument
178+
* @param <D> the type of the fourth argument
179+
* @since 10.0.0
180+
*/
96181
@FunctionalInterface
97182
interface N4Factory<A, B, C, D> {
98183

@@ -101,9 +186,10 @@ interface N4Factory<A, B, C, D> {
101186
}
102187

103188
/**
104-
* Print the debug message.
189+
* Prints a debug message.
105190
*
106-
* @param message the message.
191+
* @param message the message to print
192+
* @since 10.0.0
107193
*/
108194
default void debug(@NonNull String message) {
109195
print(LoggerLevel.DEBUG, message);

rlib-logger-api/src/main/java/javasabr/rlib/logger/api/LoggerFactory.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,68 @@
22

33
import java.io.Writer;
44

5+
/**
6+
* Factory for creating {@link Logger} instances.
7+
*
8+
* @since 10.0.0
9+
*/
510
public interface LoggerFactory {
611

12+
/**
13+
* Creates a logger with the specified name.
14+
*
15+
* @param name the logger name
16+
* @return the logger instance
17+
* @since 10.0.0
18+
*/
719
Logger make(String name);
820

21+
/**
22+
* Creates a logger for the specified class.
23+
*
24+
* @param type the class to create a logger for
25+
* @return the logger instance
26+
* @since 10.0.0
27+
*/
928
Logger make(Class<?> type);
1029

30+
/**
31+
* Returns the default logger.
32+
*
33+
* @return the default logger
34+
* @since 10.0.0
35+
*/
1136
Logger getDefault();
1237

38+
/**
39+
* Adds a listener to receive log output.
40+
*
41+
* @param listener the listener to add
42+
* @since 10.0.0
43+
*/
1344
void addListener(LoggerListener listener);
1445

46+
/**
47+
* Removes a previously added listener.
48+
*
49+
* @param listener the listener to remove
50+
* @since 10.0.0
51+
*/
1552
void removeListener(LoggerListener listener);
1653

54+
/**
55+
* Adds a writer to receive log output.
56+
*
57+
* @param writer the writer to add
58+
* @since 10.0.0
59+
*/
1760
void addWriter(Writer writer);
1861

62+
/**
63+
* Removes a previously added writer.
64+
*
65+
* @param writer the writer to remove
66+
* @since 10.0.0
67+
*/
1968
void removeWriter(Writer writer);
2069
}

rlib-logger-api/src/main/java/javasabr/rlib/logger/api/LoggerLevel.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import lombok.experimental.FieldDefaults;
88

99
/**
10-
* @author JavaSaBr
10+
* Enumeration of log levels.
11+
*
12+
* @since 10.0.0
1113
*/
1214
@Getter
1315
@RequiredArgsConstructor
@@ -19,6 +21,9 @@ public enum LoggerLevel {
1921
WARNING("WARNING", "", true, true),
2022
ERROR("ERROR", " ", true, true);
2123

24+
/**
25+
* The number of log levels.
26+
*/
2227
public static final int LENGTH = values().length;
2328

2429
String title;
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
package javasabr.rlib.logger.api;
22

33
/**
4-
* @author JavaSaBr
4+
* Listener for receiving log output.
5+
*
6+
* @since 10.0.0
57
*/
68
public interface LoggerListener {
79

10+
/**
11+
* Called when a log line is printed.
12+
*
13+
* @param text the log text
14+
* @since 10.0.0
15+
*/
816
void println(String text);
917

18+
/**
19+
* Called to flush any buffered output.
20+
*
21+
* @since 10.0.0
22+
*/
1023
default void flush() {}
1124
}

0 commit comments

Comments
 (0)