Resolves checkstyle errors for dao data-bus data-locality data-mapper data-transfer-object decorator (#1067)
* Reduces checkstyle errors in dao * Reduces checkstyle errors in data-bus * Reduces checkstyle errors in data-locality * Reduces checkstyle errors in data-mapper * Reduces checkstyle errors in data-transfer-object * Reduces checkstyle errors in decorator
This commit is contained in:
committed by
Ilkka Seppälä
parent
eae09fc07e
commit
01e489c77b
@ -23,11 +23,10 @@
|
||||
|
||||
package com.iluwatar.datamapper;
|
||||
|
||||
import java.util.Optional;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* The Data Mapper (DM) is a layer of software that separates the in-memory objects from the
|
||||
* database. Its responsibility is to transfer data between the two and also to isolate them from
|
||||
@ -35,19 +34,18 @@ import java.util.Optional;
|
||||
* present; they need no SQL interface code, and certainly no knowledge of the database schema. (The
|
||||
* database schema is always ignorant of the objects that use it.) Since it's a form of Mapper ,
|
||||
* Data Mapper itself is even unknown to the domain layer.
|
||||
* <p>
|
||||
* The below example demonstrates basic CRUD operations: Create, Read, Update, and Delete.
|
||||
*
|
||||
*
|
||||
* <p>The below example demonstrates basic CRUD operations: Create, Read, Update, and Delete.
|
||||
*/
|
||||
public final class App {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(App.class);
|
||||
private static final String STUDENT_STRING = "App.main(), student : ";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*
|
||||
*
|
||||
* @param args command line args.
|
||||
*/
|
||||
public static void main(final String... args) {
|
||||
@ -81,5 +79,6 @@ public final class App {
|
||||
mapper.delete(student);
|
||||
}
|
||||
|
||||
private App() {}
|
||||
private App() {
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,8 @@ package com.iluwatar.datamapper;
|
||||
/**
|
||||
* Using Runtime Exception for avoiding dependancy on implementation exceptions. This helps in
|
||||
* decoupling.
|
||||
*
|
||||
* @author amit.dixit
|
||||
*
|
||||
* @author amit.dixit
|
||||
*/
|
||||
public final class DataMapperException extends RuntimeException {
|
||||
|
||||
@ -39,7 +38,7 @@ public final class DataMapperException extends RuntimeException {
|
||||
* initialized, and may subsequently be initialized by a call to {@link #initCause}.
|
||||
*
|
||||
* @param message the detail message. The detail message is saved for later retrieval by the
|
||||
* {@link #getMessage()} method.
|
||||
* {@link #getMessage()} method.
|
||||
*/
|
||||
public DataMapperException(final String message) {
|
||||
super(message);
|
||||
|
@ -23,11 +23,10 @@
|
||||
|
||||
package com.iluwatar.datamapper;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Class defining Student
|
||||
* Class defining Student.
|
||||
*/
|
||||
public final class Student implements Serializable {
|
||||
|
||||
@ -39,11 +38,11 @@ public final class Student implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Use this constructor to create a Student with all details
|
||||
* Use this constructor to create a Student with all details.
|
||||
*
|
||||
* @param studentId as unique student id
|
||||
* @param name as student name
|
||||
* @param grade as respective grade of student
|
||||
* @param name as student name
|
||||
* @param grade as respective grade of student
|
||||
*/
|
||||
public Student(final int studentId, final String name, final char grade) {
|
||||
this.studentId = studentId;
|
||||
@ -51,57 +50,30 @@ public final class Student implements Serializable {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the student id
|
||||
*/
|
||||
public int getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param studentId as unique student id
|
||||
*/
|
||||
public void setStudentId(final int studentId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return name of student
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name as 'name' of student
|
||||
*/
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return grade of student
|
||||
*/
|
||||
public char getGrade() {
|
||||
return grade;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param grade as 'grade of student'
|
||||
*/
|
||||
public void setGrade(final char grade) {
|
||||
this.grade = grade;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(final Object inputObject) {
|
||||
|
||||
@ -125,9 +97,6 @@ public final class Student implements Serializable {
|
||||
return isEqual;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
@ -135,9 +104,6 @@ public final class Student implements Serializable {
|
||||
return this.getStudentId();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Student [studentId=" + studentId + ", name=" + name + ", grade=" + grade + "]";
|
||||
|
@ -26,7 +26,7 @@ package com.iluwatar.datamapper;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Interface lists out the possible behaviour for all possible student mappers
|
||||
* Interface lists out the possible behaviour for all possible student mappers.
|
||||
*/
|
||||
public interface StudentDataMapper {
|
||||
|
||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Implementation of Actions on Students Data
|
||||
* Implementation of Actions on Students Data.
|
||||
*/
|
||||
public final class StudentDataMapperImpl implements StudentDataMapper {
|
||||
|
||||
@ -84,7 +84,8 @@ public final class StudentDataMapperImpl implements StudentDataMapper {
|
||||
} else {
|
||||
|
||||
/* Throw user error after wrapping in a runtime exception */
|
||||
throw new DataMapperException("Student already [" + studentToBeInserted.getName() + "] exists");
|
||||
throw new DataMapperException("Student already [" + studentToBeInserted
|
||||
.getName() + "] exists");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user