A dummy Artist model
In the following sections, we will give make reference to an artist
model. It is a simple class
with a companion object
, defined as follows:
case class Artist(name: String, country: String) object Artist { val availableArtist = Seq(Artist("Wolfgang Amadeus Mozart", "Austria"), Artist("Ludwig van Beethoven", "Germany"), Artist("Johann Sebastian Bach", "Germany"), Artist("Frédéric François Chopin", "Poland"), Artist("Joseph Haydn", "Austria"), Artist("Antonio Lucio Vivaldi", "Italy"), Artist("Franz Peter Schubert", "Austria"), Artist("Franz Liszt", "Austria"), Artist("Giuseppe Fortunino Francesco Verdi", "Austria")) def fetch: Seq[Artist] = { availableArtist } def fetchByName(name: String): Seq[Artist] = { availableArtist.filter(a => a.name.contains(name)) } def fetchByCountry(country: String): Seq[Artist] = { availableArtist.filter(a => a.country == country) } def fetchByNameOrCountry...