docs: data mapper docs (#2900)

This commit is contained in:
Ilkka Seppälä
2024-04-07 13:59:26 +03:00
committed by GitHub
parent ea55eb4e58
commit 39acd1d0fb
6 changed files with 111 additions and 140 deletions
@@ -24,6 +24,8 @@
*/
package com.iluwatar.datamapper;
import java.io.Serial;
/**
* Using Runtime Exception for avoiding dependency on implementation exceptions. This helps in
* decoupling.
@@ -32,6 +34,7 @@ package com.iluwatar.datamapper;
*/
public final class DataMapperException extends RuntimeException {
@Serial
private static final long serialVersionUID = 1L;
/**
@@ -24,6 +24,7 @@
*/
package com.iluwatar.datamapper;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@@ -41,6 +42,7 @@ import lombok.ToString;
@AllArgsConstructor
public final class Student implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@EqualsAndHashCode.Include
@@ -27,10 +27,12 @@ package com.iluwatar.datamapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import lombok.Getter;
/**
* Implementation of Actions on Students Data.
*/
@Getter
public final class StudentDataMapperImpl implements StudentDataMapper {
/* Note: Normally this would be in the form of an actual database */
@@ -70,8 +72,4 @@ public final class StudentDataMapperImpl implements StudentDataMapper {
throw new DataMapperException("Student [" + name + "] is not found");
}
}
public List<Student> getStudents() {
return this.students;
}
}