You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
557 B
Java
31 lines
557 B
Java
package json;
|
|
import modeles.Salle;
|
|
import com.google.gson.Gson;
|
|
|
|
public class gsonGenerator {
|
|
String chaineJson;
|
|
|
|
/**
|
|
* @param chaineJson
|
|
*/
|
|
public gsonGenerator() {
|
|
|
|
|
|
}
|
|
/*chaine json =
|
|
"{'positionX':0,
|
|
'positionY':0,
|
|
'sortie':false,
|
|
'monstre':[{'nom':premier monstre,'pAttaque':5}],
|
|
'porte':[{'ouvert':=true, 'position':"H"}]}"
|
|
*/
|
|
public Salle generate(String chaine) {
|
|
Gson gson = new Gson();
|
|
Salle salle = gson.fromJson(chaine, Salle.class);
|
|
System.out.println(salle.estVide());
|
|
return salle;
|
|
}
|
|
|
|
|
|
}
|