HW3 all Right

This commit is contained in:
2025mohseni
2026-06-04 23:56:47 +03:30
parent 6a01e43eb2
commit bd0d2de7d5
5 changed files with 125 additions and 128 deletions
+58 -11
View File
@@ -1,24 +1,71 @@
package movie.apis;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Model class representing a movie
* Fields: id, title, genres, images
*/
public class Movie {
private Long id;
private String title;
private List<String> genres;
private List<String> images;
private String year;
private String imdb_rating;
private String country;
// TODO: Create a constructor with all fields
// استفاده از SerializedName برای تطبیق دقیق با کلیدهای JSON
@SerializedName("imdb_rating")
private String imdbRating;
// TODO: Create a simple constructor with id and title only
@SerializedName("imdb_votes")
private String imdbVotes;
// TODO: Create getters and setters for all fields
private String director;
private String actors;
private String plot;
private String awards;
private String rated;
private String runtime;
private List<String> genres;
private List<String> images;
// Constructor کامل
public Movie(Long id, String title, String year, String country, String imdbRating, String imdbVotes,
String director, String actors, String plot, String awards, String rated, String runtime,
List<String> genres, List<String> images) {
this.id = id;
this.title = title;
this.year = year;
this.country = country;
this.imdbRating = imdbRating;
this.imdbVotes = imdbVotes;
this.director = director;
this.actors = actors;
this.plot = plot;
this.awards = awards;
this.rated = rated;
this.runtime = runtime;
this.genres = genres;
this.images = images;
}
// Constructor ساده
public Movie(Long id, String title) {
this.id = id;
this.title = title;
}
// Getters and Setters
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public String getYear() { return year; }
public void setYear(String year) { this.year = year; }
public String getImdbRating() { return imdbRating; }
public String getImdbVotes() { return imdbVotes; }
public String getDirector() { return director; }
public String getActors() { return actors; }
public String getPlot() { return plot; }
public String getAwards() { return awards; }
public String getRated() { return rated; }
public String getRuntime() { return runtime; }
public String getGenre() { return genres != null ? String.join(", ", genres) : "N/A"; }
}