Skip to content
Snippets Groups Projects
Verified Commit 78f33261 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Fix depedendency

parent b2b910e4
Branches
No related merge requests found
......@@ -67,15 +67,38 @@
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/org.eclipse.persistence.moxy -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>3.0.2</version>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-xjc -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>4.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.json/jakarta.json-api -->
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.parsson/parsson -->
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</project>
......@@ -51,15 +51,25 @@ public class StreamMain {
(t2.getPlayers().get(0) == t2.getMatches().get(0).getOponents().getPlayer1()));
printTournamentAsXML(t);
t2 = loadTournamentFromXML();
System.out.print("p1 == m.oponents.player1 " +
(t2.getPlayers().get(0) == t2.getMatches().get(0).getOponents().getPlayer1()));
printTournamentAsJSON(t);
t2 = loadTournamentFromJSON();
System.out.print("p1 == m.oponents.player1 " +
(t2.getPlayers().get(0) == t2.getMatches().get(0).getOponents().getPlayer1()));
}
public static void printStatAboutTournament(Tournament tournament) {
public static void printStatAboutTournament(Tournament tournament) {
System.out.println(tournament);
Player player = tournament.getRandomPlayer();
......@@ -142,6 +152,7 @@ public static Tournament loadTournament() {
marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");
marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
marshaller.marshal(tournament, System.out);
marshaller.marshal(tournament, new File("tournament.json"));
} catch (JAXBException e) {
e.printStackTrace();
}
......@@ -149,16 +160,29 @@ public static Tournament loadTournament() {
private static Tournament loadTournamentFromXML() {
try {
JAXBContext context = JAXBContext.newInstance(Tournament.class);
Unmarshaller unmarshaller= context.createUnmarshaller();
return (Tournament) unmarshaller.unmarshal(new File("tournament.xml"));
} catch (JAXBException e) {
e.printStackTrace();
private static Tournament loadTournamentFromXML() {
try {
JAXBContext context = JAXBContext.newInstance(Tournament.class);
Unmarshaller unmarshaller= context.createUnmarshaller();
return (Tournament) unmarshaller.unmarshal(new File("tournament.xml"));
} catch (JAXBException e) {
e.printStackTrace();
}
return null;
}
private static Tournament loadTournamentFromJSON() {
try {
JAXBContext context = JAXBContext.newInstance(Tournament.class);
Unmarshaller unmarshaller= context.createUnmarshaller();
unmarshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json");
unmarshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
return (Tournament) unmarshaller.unmarshal(new File("tournament.json"));
} catch (JAXBException e) {
e.printStackTrace();
}
return null;
}
return null;
}
}
......@@ -4,6 +4,8 @@ module cz.jezek.lab10 {
requires jakarta.xml.bind;
requires java.sql;
requires org.eclipse.persistence.moxy;
requires jakarta.json;
requires com.sun.tools.xjc;
opens cz.jezek.lab11;
exports cz.jezek.lab11;
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment