/* * Name : Song * * Description : The Song class is used to create songs while extending MusicalElement * * Version : 1.0 * * Date : 28/12/2020 * * Copyright : Aimeric ADJUTOR */ /** * The Song class is used to create songs while extending MusicalElement. * * @version 1.0 * * @see MusicalElement * @author Aimeric ADJUTOR */ public class Song extends MusicalElement{ private static final long serialVersionUID = 2112880640160601826L; private String artist, genre; /** * Constructor method. * * @param title String * @param duration int * @param content String, path to the mp3 file * @param artist String * @param genre Genre * * @see Genre * * @author Aimeric ADJUTOR * */ public Song(String title, int duration, String content, String artist, Genre genre) { super(title, duration, content); this.artist=artist; this.genre=genre.name(); } /** * This method is used to give the artist of the song. * * @return artist String * * @author Aimeric ADJUTOR * */ public String getArtist(){return artist;} /** * This method is used to give the genre of the song. * * @return It returns the genre, which is a String because the constructor use the name method of the Genre class. * * @see Genre * @author Aimeric ADJUTOR * */ public String getGenre(){return genre;} /** * Basic method to set the artist of the song. * * @param artist String * * @author Aimeric ADJUTOR * */ public void setArtist(String artist){this.artist=artist;} /** * Basic method to set the genre of the song using the name method from the Genre class. * * @param genre Genre * * @see Genre * * @author Aimeric ADJUTOR * */ public void setGenre(Genre genre){this.genre=genre.name();} /** * Basic method to "configure" what does a print of this object actually does. * * @return String, using the object's methods * * @author Aimeric ADJUTOR * */ public String toString() { return "Id : "+getId()+"\nTitle : "+getTitle()+"\nDuration : "+getDuration()+"\nContent : "+getContent()+"\nArtist : "+getArtist()+"\nGenre : "+getGenre()+"\n"; } }