I have the following class in Java. I would like to be able to save it into a common file format that would be able to moved across different pc's. I know about object serialization but I was wondering what are my other options and what are their respective pros and cons. Thanks! Like for example a serialized file is not human readable and therefore a con.
public class NervousSystem {
private CentralNervousSystem CNS;
private PeripheralNervousSystem PNS;
public NervousSystem(Neocortex neocortex, LateralGeniculateNucleus LGN, Retina retina) {
this.CNS = new CentralNervousSystem(neocortex, LGN);
this.PNS = new PeripheralNervousSystem(retina);
}
public CentralNervousSystem getCNS() {
return this.CNS;
}
public PeripheralNervousSystem getPNS() {
return this.PNS;
}
}
You can serialize the objects to JSON using e.g. Jackson, which will greatly improve their human readability
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With