package Ġde . u ul m . se . co uched it . serialization . controller . impl Ċ Ċ import Ġcom . google . inject . Inject Ċ import Ġcom . google . inject . Singleton Ċ import Ġcom . ow like . gen son . Gen son Ċ import Ġde . u ul m . se . co uched it . serialization . controller . Pers ister Ċ import Ġde . u ul m . se . co uched it . serialization . model . Element Collection Ċ import Ġjava . io . BufferedReader Ċ import Ġjava . io . Buffered Writer Ċ import Ġjava . io . FileReader Ċ import Ġjava . io . FileWriter Ċ Ċ @ Singleton Ċ internal Ġclass ĠGen son Pers ister Ġ@ Inject Ġconstructor ( private Ġval Ġgson : ĠGen son ) Ġ: ĠPers ister Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġpersist ( elements : ĠElement Collection , Ġpath : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbw Ġ= ĠBuffered Writer ( FileWriter ( path )) ĊĊĠĠĠĠĠĠĠ Ġgson . serialize ( elements , Ġbw ) ĊĊĠĠĠĠĠĠĠ Ġbw . close () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġload ( path : ĠString ): ĠElement Collection Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbr Ġ= ĠBufferedReader ( FileReader ( path )) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġgson . deserialize ( br , ĠElement Collection :: class . java ) ĊĠĠĠ Ġ} Ċ } Ċ