Skip to content

Commit da397ae

Browse files
authored
docs: add JavaDoc class-level comments to resolve 46 warnings (#245)
* docs: add JavaDoc class-level comments to resolve 46 warnings Add comprehensive class-level JavaDoc documentation to all classes that were generating "use of default constructor, which does not provide a comment" warnings during javadoc generation. Changes include: - Add/improve class-level JavaDoc for 42 classes across audit, service, DTO, controller, API, listener, profile, web, config, roles, util, and validation packages - Add lombok.config to configure @generated annotation on Lombok-generated code - Configure Javadoc task in build.gradle to suppress warnings for Lombok-generated constructors that cannot be documented All JavaDoc comments follow project conventions with @author tags and @see references to related classes where appropriate. * fix: address PR feedback on JavaDoc consistency Remove unnecessary default constructor comments and restore @requiredargsconstructor for consistency across the codebase. Changes: - Remove "Default constructor creates..." comments from classes without explicit constructors (PasswordMatchesValidator, GlobalValidationExceptionHandler, UserConfiguration, UserAutoConfigurationRegistrar) - Remove explicit constructor from AuditConfig (@DaTa handles it) - Restore @requiredargsconstructor in audit package classes (AuditEventListener, FileAuditLogWriter, FileAuditLogFlushScheduler) for consistency with rest of codebase All classes now rely on lombok.config and build.gradle Javadoc configuration to handle Lombok-generated constructor warnings. * chore: standardize @author tags to Devon Hillard Replace "Digital Sanctuary" with "Devon Hillard" in 11 files for consistent author attribution. Preserved Edamijueda's attribution on PasswordPolicyService.
1 parent 5b6d672 commit da397ae

44 files changed

Lines changed: 386 additions & 147 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ tasks.named('jar') {
122122
archiveClassifier.set('')
123123
}
124124

125+
// Configure Javadoc to suppress warnings for missing constructor documentation
126+
// This is necessary because Lombok generates constructors that cannot be documented
127+
tasks.withType(Javadoc).configureEach {
128+
options.addStringOption('Xdoclint:all,-missing', '-quiet')
129+
}
130+
125131
def registerJdkTestTask(name, jdkVersion) {
126132
tasks.register(name, Test) {
127133
javaLauncher.set(javaToolchains.launcherFor {

lombok.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file configures Lombok for the project
2+
# See https://projectlombok.org/features/configuration
3+
4+
# Add @Generated annotation to all Lombok-generated code
5+
# This suppresses Javadoc warnings about missing constructor documentation
6+
lombok.addLombokGeneratedAnnotation = true

src/main/java/com/digitalsanctuary/spring/user/UserAutoConfigurationRegistrar.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import org.springframework.core.type.AnnotationMetadata;
77

88
/**
9-
* {@code UserAutoConfigurationRegistrar} dynamically registers the base package of this library with Spring Boot to ensure that its entities,
9+
* Dynamically registers the base package of this library with Spring Boot to ensure that its entities,
1010
* repositories, and other Spring-managed components are properly detected and included in the application context.
1111
*
1212
* <p>
13-
* This class is designed to simplify the integration of the library into Spring Boot applications by automatically registering the library's base
14-
* package (<i>com.digitalsanctuary.spring.user</i>) for component scanning. It ensures that:
13+
* This class simplifies integration by automatically registering the library's base
14+
* package ({@code com.digitalsanctuary.spring.user}) for component scanning. It ensures that:
1515
* <ul>
1616
* <li>The library's repositories and entities are discovered and configured correctly.</li>
1717
* <li>The consuming application retains its ability to automatically detect its own repositories and entities.</li>

src/main/java/com/digitalsanctuary/spring/user/UserConfiguration.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
import lombok.extern.slf4j.Slf4j;
1212

1313
/**
14-
* The UserConfiguration class is a Spring Boot configuration class that provides configuration for the DigitalSanctuary Spring Boot User Framework
15-
* Library. This class is used to configure the user framework library, including enabling asynchronous processing and scheduling, and scanning for
16-
* components and repositories.
14+
* Main auto-configuration class for the DigitalSanctuary Spring Boot User Framework Library.
15+
* Enables asynchronous processing, retry support, scheduling, method-level security,
16+
* and component scanning for the user framework package.
17+
*
18+
* @see UserAutoConfigurationRegistrar
1719
*/
1820
@Slf4j
1921
@Configuration

src/main/java/com/digitalsanctuary/spring/user/api/UserAPI.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@
3838
import lombok.extern.slf4j.Slf4j;
3939

4040
/**
41-
* REST controller for managing user-related operations. This class handles user
42-
* registration, account deletion, and other user-related endpoints.
41+
* REST API controller for user management operations.
42+
* <p>
43+
* Provides JSON endpoints for user registration, authentication, profile updates,
44+
* password management, and account deletion. All endpoints are mapped under
45+
* {@code /user} and return JSON responses.
46+
* </p>
47+
*
48+
* @author Devon Hillard
49+
* @see UserService
50+
* @see UserEmailService
4351
*/
4452
@Slf4j
4553
@RequiredArgsConstructor

src/main/java/com/digitalsanctuary/spring/user/audit/AuditConfig.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@
66
import lombok.Data;
77

88
/**
9-
* The AuditConfig class is a Spring Boot configuration class that provides properties for configuring user audit logging. This class is used to
10-
* define properties that control the behavior of the audit logging, such as the log file path and the flush rate.
9+
* Configuration properties for the user audit logging system.
10+
*
11+
* <p>This class defines properties that control the behavior of audit logging,
12+
* including the log file path, flush behavior, and event logging toggle.
13+
* Properties are bound from the {@code user.audit.*} prefix in application configuration.
14+
*
15+
* <p>The class uses Lombok's {@code @Data} annotation which generates getters, setters,
16+
* and a default no-argument constructor.
17+
*
18+
* @see AuditLogWriter
19+
* @see AuditEventListener
1120
*/
1221
@Data
1322
@Component

src/main/java/com/digitalsanctuary/spring/user/audit/AuditEventListener.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@
77
import lombok.extern.slf4j.Slf4j;
88

99
/**
10-
* This class processes AuditEvents. This class writes the AuditEvent data to a text file on the server. You could easily change the logic to write to
11-
* a database, send events to a REST API, or anything else.
10+
* Spring event listener that processes {@link AuditEvent} instances asynchronously.
11+
*
12+
* <p>This component listens for audit events and delegates the writing of event data
13+
* to an {@link AuditLogWriter} implementation. The processing is asynchronous to avoid
14+
* impacting application performance.
15+
*
16+
* <p>The listener only processes events when audit logging is enabled via
17+
* {@code AuditConfig.isLogEvents()}. All exceptions are caught and logged to ensure
18+
* audit failures never impact application flow.
1219
*
1320
* @see AuditEvent
21+
* @see AuditLogWriter
22+
* @see AuditConfig
1423
*/
1524
@Slf4j
1625
@Async

src/main/java/com/digitalsanctuary/spring/user/audit/FileAuditLogFlushScheduler.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,30 @@
77
import lombok.extern.slf4j.Slf4j;
88

99
/**
10-
* The FileAuditLogFlushScheduler class is a Spring Boot component that flushes the audit log buffer to the file. This class is used to ensure that
11-
* the audit log buffer is flushed periodically to balance performance with data integrity.
12-
*
13-
* <p><strong>Conditional Activation Logic:</strong></p>
14-
* <p>This scheduler is only active when BOTH conditions are met:</p>
10+
* Scheduled task that periodically flushes the audit log buffer to disk.
11+
*
12+
* <p>This component ensures buffered audit data is written to the file at regular intervals,
13+
* balancing write performance with data integrity.
14+
*
15+
* <p><strong>Conditional Activation:</strong> This scheduler is only active when both conditions are met:
1516
* <ul>
16-
* <li><code>user.audit.logEvents=true</code> (audit logging is enabled) AND</li>
17-
* <li><code>user.audit.flushOnWrite=false</code> (immediate flush is disabled)</li>
17+
* <li>{@code user.audit.logEvents=true} - audit logging is enabled</li>
18+
* <li>{@code user.audit.flushOnWrite=false} - immediate flush is disabled</li>
1819
* </ul>
19-
*
20-
* <p><strong>Why this conditional logic?</strong></p>
21-
* <ul>
22-
* <li>If audit logging is disabled (<code>logEvents=false</code>), no scheduler is needed</li>
23-
* <li>If flush-on-write is enabled (<code>flushOnWrite=true</code>), logs are flushed immediately after each write,
24-
* so periodic flushing is unnecessary and would be redundant</li>
25-
* <li>Only when audit logging is enabled AND flush-on-write is disabled do we need this periodic scheduler
26-
* to ensure buffered data gets written to disk at regular intervals</li>
27-
* </ul>
28-
*
29-
* <p>The flush frequency is controlled by <code>user.audit.flushRate</code> (in milliseconds).</p>
20+
*
21+
* <p>When flush-on-write is enabled, logs are flushed immediately after each write,
22+
* making this scheduler unnecessary. The flush frequency is controlled by
23+
* {@code user.audit.flushRate} (in milliseconds).
24+
*
25+
* @see FileAuditLogWriter
26+
* @see AuditConfig
3027
*/
3128
@Slf4j
3229
@Component
33-
@RequiredArgsConstructor
3430
@ConditionalOnExpression("${user.audit.logEvents:true} && !${user.audit.flushOnWrite:true}")
31+
@RequiredArgsConstructor
3532
public class FileAuditLogFlushScheduler {
3633

37-
/**
38-
* The file audit log writer. This is the writer that is used to write audit log events to the file.
39-
*/
4034
private final FileAuditLogWriter fileAuditLogWriter;
4135

4236
/**

src/main/java/com/digitalsanctuary/spring/user/audit/FileAuditLogWriter.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@
1616
import lombok.extern.slf4j.Slf4j;
1717

1818
/**
19-
* Implementation of {@link AuditLogWriter} that writes audit logs to a file. This class handles the lifecycle of the log file, including opening,
20-
* writing, and closing the file. It also supports scheduled flushing of the buffer to balance performance with data integrity.
19+
* File-based implementation of {@link AuditLogWriter} that writes audit events to a log file.
20+
*
21+
* <p>This component manages the complete lifecycle of the audit log file, including:
22+
* <ul>
23+
* <li>Opening and creating the log file on startup ({@code @PostConstruct})</li>
24+
* <li>Writing formatted audit events with pipe-delimited fields</li>
25+
* <li>Periodic buffer flushing via {@link FileAuditLogFlushScheduler}</li>
26+
* <li>Graceful cleanup on shutdown ({@code @PreDestroy})</li>
27+
* </ul>
28+
*
29+
* <p>If the configured log path is not writable, the writer falls back to a temporary
30+
* directory location.
31+
*
32+
* @see AuditLogWriter
33+
* @see AuditConfig
34+
* @see FileAuditLogFlushScheduler
2135
*/
2236
@Slf4j
2337
@Component

src/main/java/com/digitalsanctuary/spring/user/controller/UserActionController.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@
2222
import lombok.extern.slf4j.Slf4j;
2323

2424
/**
25-
* The UserActionController handles non-API, non-Page requests like token
26-
* validation links from emails.
25+
* Controller that handles user action requests triggered by email links.
26+
* <p>
27+
* This controller processes token-based actions such as email verification
28+
* during registration and password reset token validation. These endpoints
29+
* are typically accessed when users click links in system-generated emails.
30+
* </p>
31+
*
32+
* @author Devon Hillard
33+
* @see UserService
34+
* @see UserVerificationService
2735
*/
2836
@Slf4j
2937
@RequiredArgsConstructor

0 commit comments

Comments
 (0)