mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 14:59:25 +00:00
docs: data mapper docs (#2900)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user