refactoring: Issue #2377: The repository code has been refactored to use the recor… (#2505)

* Issue #2377: The repository code has been refactored to use the record class

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code

* Issue #2377: Refactored according to the rules defined for the repo code
This commit is contained in:
Mughees Qasim
2023-05-06 14:08:12 +05:00
committed by GitHub
parent c0e1603f90
commit 3ae6b07590
26 changed files with 244 additions and 293 deletions
@@ -26,34 +26,10 @@ package com.iluwatar.partialresponse;
/**
* {@link Video} is a entity to serve from server.It contains all video related information.
* Video is a record class.
*/
public class Video {
private final Integer id;
private final String title;
private final Integer length;
private final String description;
private final String director;
private final String language;
/**
* Constructor.
*
* @param id video unique id
* @param title video title
* @param len video length in minutes
* @param desc video description by publisher
* @param director video director name
* @param lang video language {private, public}
*/
public Video(Integer id, String title, Integer len, String desc, String director, String lang) {
this.id = id;
this.title = title;
this.length = len;
this.description = desc;
this.director = director;
this.language = lang;
}
public record Video(Integer id, String title, Integer length, String description, String director, String language) {
/**
* ToString.
*
@@ -62,12 +38,12 @@ public class Video {
@Override
public String toString() {
return "{"
+ "\"id\": " + id + ","
+ "\"title\": \"" + title + "\","
+ "\"length\": " + length + ","
+ "\"description\": \"" + description + "\","
+ "\"director\": \"" + director + "\","
+ "\"language\": \"" + language + "\","
+ "}";
+ "\"id\": " + id + ","
+ "\"title\": \"" + title + "\","
+ "\"length\": " + length + ","
+ "\"description\": \"" + description + "\","
+ "\"director\": \"" + director + "\","
+ "\"language\": \"" + language + "\","
+ "}";
}
}