serverName = "gameserver";
}
LOGGER.info("Processing {} to {} packets", (fromClient ? "client" : serverName), (fromClient ? serverName : "client"));
JPackage directionPackage = codeModel._package("be.demmel.jgws.packets." + serverName + "." + (fromClient ? "incoming" : "outgoing"));
LOGGER.info("Packets will be generated in package: {}", directionPackage);
for (PacketType packet : direction.getPacket()) {
// TODO: make the fields mandatory
String packetInfo = (packet.getInfo() == null || packet.getInfo().getName() == null) ? "Unknown" : packet.getInfo().getName();
String packetName = "P" + String.format("%03d", packet.getHeader()) + "_" + packetInfo;
LOGGER.info("Processing packet: {}", packetName);
JDefinedClass packetClass = directionPackage._class(JMod.FINAL | JMod.PUBLIC, packetName)._implements(Packet.class);
// TODO: make the fields mandatory
String packetDescription = (packet.getInfo() == null || packet.getInfo().getDescription() == null || packet.getInfo().getDescription().isEmpty()) ? "" : WordUtils.wrap(packet
.getInfo().getDescription(), /* maximumLength */50);
LOGGER.debug("Packet description: {}", packetDescription);