@Test public void deserialize() { Server server = new Server( "name", true, 10, 100 ); ServerMapper<Server> mapper = new StandardServerMapper(); Map<String, String> serialized = mapper.serialize(server); assertEquals(server, mapper.deserialize(serialized)); }
@Override public Server deserialize(Map<String, String> data) { return new Server( data.get("name"), Boolean.valueOf(data.get("enabled")), Integer.valueOf(data.get("onlinePlayers")), Integer.valueOf(data.get("maxPlayers")) ); }
StandardServerMapper implements ServerMapper<Server> { @Override public Server deserialize(Map<String, String> data) { return new Server( data.get("name"), Boolean.valueOf(data.get("enabled")), Integer.valueOf(data.get("onlinePlayers")), Integer.valueOf(data.get("maxPlayers")) ); } }
StandardServerMapper implements ServerMapper<Server> { @Override public Server deserialize(Map<String, String> data) { return new Server( data.get("name"), Boolean.valueOf(data.get("enabled")), Integer.valueOf(data.get("onlinePlayers")), Integer.valueOf(data.get("maxPlayers")) ); }  }
StandardServerMapper implements ServerMapper<Server> { @Override public Server deserialize(Map<String, String> data) { return new Server( data.get("name"), Boolean.valueOf(data.get("enabled")), Integer.valueOf(data.get("onlinePlayers")), Integer.valueOf(data.get("maxPlayers")) ); }  @Override Server deserialize(Map<String, String> data); @Override Map<String, String> serialize(Server server); }
StandardServerMapper implements ServerMapper<Server> { @Override public Server deserialize(Map<String, String> data) { return new Server( data.get("name"), Boolean.valueOf(data.get("enabled")), Integer.valueOf(data.get("onlinePlayers")), Integer.valueOf(data.get("maxPlayers")) ); }  @Override Server deserialize(Map<String, String> data); @Override Map<String, String> serialize(Server server);  }