Skip to content
Merged
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
33 changes: 32 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,38 @@ void testStatementSerialization() throws JsonProcessingException {

### Documentation

- **JavaDoc**: Document all public APIs with comprehensive JavaDoc comments
#### JavaDoc Guidelines

All public APIs must be documented with comprehensive JavaDoc comments:

- **Classes and interfaces**: Include a brief description and link to relevant xAPI specification sections
- **Public methods**: Document purpose, parameters (`@param`), return values (`@return`), and exceptions (`@throws`)
- **Validation annotations**: Include `@return` tags for `message()`, `groups()`, and `payload()` methods
- **Constructor parameters**: Document all constructor parameters with `@param` tags

**Important**: Lombok-generated code (builders, constructors) may produce unavoidable javadoc warnings. These are suppressed via Maven configuration and do not need manual documentation.

Example:
```java
/**
* Gets a Statement from the LRS.
* <p>
* The returned ResponseEntity contains the response headers and the Statement.
* </p>
*
* @param request the get statement request
*
* @return the ResponseEntity
*
* @see <a href="https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#213-get-statements">xAPI GET Statements</a>
*/
public Mono<ResponseEntity<Statement>> getStatement(GetStatementRequest request) {
// implementation
}
```

**Generating JavaDoc**: Run `./mvnw javadoc:javadoc` to verify documentation quality.

- **README**: Update if your changes affect usage examples or getting started instructions
- **Code Comments**: Add comments only when necessary to explain complex logic (match existing style)
- Maintain copyright headers in all source files: `Copyright 2016-2025 Berry Cloud Ltd. All rights reserved.`
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- Suppress warnings for Lombok-generated code -->
<doclint>all,-missing</doclint>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public class ServerControllerAdvice extends ResponseEntityExceptionHandler {
/**
* Handles bean validation (JSR 380) exceptions and transforms them into errors that confirm to
* RFC 7807.
*
* @param request the HTTP servlet request
* @param e the throwable exception
*
* @return the error response
*/
@ResponseBody
@ExceptionHandler(ConstraintViolationException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public class StatementController {

private final StatementService statementService;

/**
* Constructor for StatementController.
*
* @param statementService the statement service
*/
public StatementController(StatementService statementService) {

this.statementService = statementService;
Expand Down Expand Up @@ -75,6 +80,8 @@ public ResponseEntity<Statement> getStatement(@RequestParam(required = true) UUI
/**
* Get Statements.
*
* @param since the instant since when to get statements
*
* @return the ResponseEntity
*
* @see <a href=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public StatementEntity() {}

/**
* StatementEntity Constructor.
*
* @param id the statement id
* @param statement the statement as JSON
*/
public StatementEntity(UUID id, JsonNode statement) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class StatementService {

/**
* StatementService Constructor.
*
* @param repository the statement repository
* @param mapper the object mapper
*/
public StatementService(StatementRepository repository, ObjectMapper mapper) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
@SpringBootApplication
public class XapiServerApplication {

/**
* Main method to start the application.
*
* @param args command line arguments
*/
public static void main(String[] args) {
SpringApplication.run(XapiServerApplication.class, args);
}
Expand Down
16 changes: 16 additions & 0 deletions xapi-client/src/main/java/dev/learning/xapi/client/XapiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public XapiClient(WebClient.Builder builder) {
* The returned ResponseEntity contains the response headers and the Statement.
* </p>
*
* @param request the get statement request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<Statement>> getStatement(GetStatementRequest request) {
Expand All @@ -104,6 +106,8 @@ public Mono<ResponseEntity<Statement>> getStatement(GetStatementRequest request)
* The returned ResponseEntity contains the response headers and the Statement.
* </p>
*
* @param request the consumer builder for the get statement request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<Statement>> getStatement(
Expand All @@ -123,6 +127,8 @@ public Mono<ResponseEntity<Statement>> getStatement(
* The returned ResponseEntity contains the response headers and the Statement identifier.
* </p>
*
* @param request the post statement request
*
* @return the ResponseEntity
*
* @throws MissingResponseBodyException if the response body is missing
Expand Down Expand Up @@ -154,6 +160,8 @@ public Mono<ResponseEntity<UUID>> postStatement(PostStatementRequest request) {
* The returned ResponseEntity contains the response headers and the Statement identifier.
* </p>
*
* @param request the consumer builder for the post statement request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<UUID>> postStatement(Consumer<PostStatementRequest.Builder> request) {
Expand All @@ -173,6 +181,8 @@ public Mono<ResponseEntity<UUID>> postStatement(Consumer<PostStatementRequest.Bu
* identifiers.
* </p>
*
* @param request the post statements request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<List<UUID>>> postStatements(PostStatementsRequest request) {
Expand Down Expand Up @@ -200,6 +210,8 @@ public Mono<ResponseEntity<List<UUID>>> postStatements(PostStatementsRequest req
* identifiers.
* </p>
*
* @param request the consumer builder for the post statements request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<List<UUID>>> postStatements(
Expand All @@ -219,6 +231,8 @@ public Mono<ResponseEntity<List<UUID>>> postStatements(
* The returned ResponseEntity contains the response headers and the voided Statement.
* </p>
*
* @param request the get voided statement request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<Statement>> getVoidedStatement(GetVoidedStatementRequest request) {
Expand All @@ -243,6 +257,8 @@ public Mono<ResponseEntity<Statement>> getVoidedStatement(GetVoidedStatementRequ
* The returned ResponseEntity contains the response headers and the voided Statement.
* </p>
*
* @param request the consumer builder for the get voided statement request
*
* @return the ResponseEntity
*/
public Mono<ResponseEntity<Statement>> getVoidedStatement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class XapiModelAutoConfiguration {

/**
* SingleValueArrayCustomizer.
*
* @return the customizer bean
*/
@Bean
public Jackson2ObjectMapperBuilderCustomizer singleValueArrayCustomizer() {
Expand All @@ -55,6 +57,8 @@ public Jackson2ObjectMapperBuilderCustomizer singleValueArrayCustomizer() {

/**
* ValidateObjectTypeCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateObjectType", havingValue = "true",
Expand All @@ -67,6 +71,8 @@ public Jackson2ObjectMapperBuilderCustomizer validateObjectTypeCustomizer() {

/**
* ValidateLocaleCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateLocale", havingValue = "true",
Expand All @@ -79,6 +85,8 @@ public Jackson2ObjectMapperBuilderCustomizer validateLocaleCustomizer() {

/**
* ValidateTimestampCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateTimestamp", havingValue = "true",
Expand All @@ -91,6 +99,8 @@ public Jackson2ObjectMapperBuilderCustomizer validateTimestampCustomizer() {

/**
* ValidateNullValuesCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateNullValues", havingValue = "true",
Expand All @@ -103,6 +113,8 @@ public Jackson2ObjectMapperBuilderCustomizer validateNullValuesCustomizer() {

/**
* ValidatePropertiesCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateProperties", havingValue = "true",
Expand All @@ -115,6 +127,8 @@ public Jackson2ObjectMapperBuilderCustomizer validatePropertiesCustomizer() {

/**
* ValidateJsonCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateJson", havingValue = "true",
Expand All @@ -127,6 +141,8 @@ public Jackson2ObjectMapperBuilderCustomizer validateJsonCustomizer() {

/**
* ValidateLiteralsCustomizer.
*
* @return the customizer bean
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateLiterals", havingValue = "true",
Expand Down Expand Up @@ -156,6 +172,8 @@ public Jackson2ObjectMapperBuilderCustomizer validateLiteralsCustomizer() {

/**
* ValidateActivityDefinitionPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateActivityDefinition", havingValue = "false")
Expand All @@ -173,6 +191,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateActorPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateActor", havingValue = "false")
Expand All @@ -190,6 +210,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateAuthorityPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateAuthority", havingValue = "false")
Expand All @@ -207,6 +229,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateUriSchemePostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateUriScheme", havingValue = "false")
Expand All @@ -224,6 +248,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateMboxPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateMbox", havingValue = "false")
Expand All @@ -241,6 +267,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateLocaleNotUndeterminedPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateLocaleNotUndetermined", havingValue = "false")
Expand All @@ -258,6 +286,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateScaledScorePostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateScaledScore", havingValue = "false")
Expand All @@ -275,6 +305,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateScorePostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateScore", havingValue = "false")
Expand All @@ -292,6 +324,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateStatementPlatformPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateStatementPlatform", havingValue = "false")
Expand All @@ -309,6 +343,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateStatementRevisionPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateStatementRevision", havingValue = "false")
Expand All @@ -326,6 +362,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateStatementListIdsPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateStatementListIds", havingValue = "false")
Expand All @@ -343,6 +381,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateStatementVerbPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateStatementVerb", havingValue = "false")
Expand All @@ -360,6 +400,8 @@ public Object postProcessAfterInitialization(Object bean, String beanName) {

/**
* ValidateUuidVariantPostProcessor.
*
* @return the bean post processor
*/
@Bean
@ConditionalOnProperty(name = "xapi.model.validateUuidVariant", havingValue = "false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class StrictLocaleDeserializer extends StdDeserializer<Locale> {

private static final long serialVersionUID = 7182941951585541965L;

/**
* Default constructor.
*/
public StrictLocaleDeserializer() {
super(String.class);
}
Expand Down
Loading