Changeset 3c0f9a9 in Git for src/main/java/com/wediscussmovies/project/querymodels/GenreLikes.java
- Timestamp:
- 02/07/22 19:57:58 (3 years ago)
- Branches:
- main
- Children:
- ad4243e, c02189f
- Parents:
- 7f36551
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/querymodels/GenreLikes.java
r7f36551 r3c0f9a9 3 3 import lombok.Data; 4 4 5 import javax.persistence.Entity; 6 import javax.persistence.Table; 7 import java.util.Comparator; 8 import java.util.Objects; 9 5 10 @Data 6 11 public class GenreLikes { 7 12 private Integer genreId; 8 13 private String name; 9 14 private Long likes; 10 15 11 public GenreLikes(String name, Long likes) { 16 public static Comparator<GenreLikes> sorter = Comparator.comparing(GenreLikes::getLikes).thenComparing(GenreLikes::getName).reversed(); 17 18 public GenreLikes(Integer genreId, String name, Long likes) { 19 this.genreId = genreId; 12 20 this.name = name; 13 21 this.likes = likes; 22 23 } 24 25 @Override 26 public boolean equals(Object o) { 27 if (this == o) return true; 28 if (o == null || getClass() != o.getClass()) return false; 29 GenreLikes that = (GenreLikes) o; 30 return Objects.equals(genreId, that.genreId); 31 } 32 33 @Override 34 public int hashCode() { 35 return Objects.hash(genreId); 14 36 } 15 37 }
Note:
See TracChangeset
for help on using the changeset viewer.