Code example for ObjectStreamField

0
    } 
 
    private static class WithMatchingSerialPersistentFields implements 
            java.io.Serializable {
        private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField(
                "anInstanceVar", String.class) };
 
        public String anInstanceVar = FOO + FOO;
 
        public WithMatchingSerialPersistentFields() { 
            super(); 
        } 
    } 
 
    private static class SerialPersistentFields implements java.io.Serializable {
        private static final String SIMULATED_FIELD_NAME = "text";
 
        private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField(
                SIMULATED_FIELD_NAME, String.class) };
 
        public int anInstanceVar = 5;