Nate Lockwood
Nate Lockwood

Reputation: 3665

XML file from serialized class is missing field data

I have some classes that exist to act is "INI" files and they work. I just wrote a new class that does serialize but the XML file has no data fields - it's just a shell. What did I do wrong? I'm using Eclipse and Ubuntu 11.10. The class:

public final class ProsilicaCamInit extends SerialXMLIO {
public boolean isMaster;
public boolean isSlave;
public int filter;
public int exposureTime;

public ProsilicaCamInit() {
}
public void setDefaultValues() {
    isMaster = false;
    isSlave = false;
    filter = 0;
    exposureTime = 5000;
}


public boolean getIsMaster() {
    return isMaster;
}

public void setIsMaster(boolean isMaster) {
    this.isMaster = isMaster;
}

public boolean getIsSlave() {
    return isSlave;
}

public void setIsSlave(boolean isSlave) {
    this.isSlave = isSlave;
}

public int getFilter() {
    return filter;
}

public void setFilter(int filter) {
    this.filter = filter;
}

public int getExposureTime() {
    return exposureTime;
}

public void setExposureTime(int exposureTime) {
    this.exposureTime = exposureTime;
}

}

I's used here

ProsilicaCamInit pci = new ProsilicaCamInit();
pci.setDefaultValues();
pci.serialize(pathName);

I have checked to see that the default values are set and here's the XML file which has only one of the fields.

<?xml version="1.0" encoding="UTF-8"?>
<java version="1.6.0_23" class="java.beans.XMLDecoder">
 <object class="fireScience.airborne.io.ProsilicaCamInit">
  <void property="exposureTime">
   <int>5000</int>
  </void>
 </object>
</java>

Upvotes: 1

Views: 299

Answers (1)

Christian Kuetbach
Christian Kuetbach

Reputation: 16060

I think the other values don't need to be stored, because false is the default value for boolean and zero is the default for int.

Upvotes: 1

Related Questions