• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/db-4.7.25.NC/test/scr024/src/com/sleepycat/collections/test/serial/
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2000,2008 Oracle.  All rights reserved.
5 *
6 * $Id: TestSerial.java.original,v 12.10 2008/02/07 17:12:32 mark Exp $
7 */
8package com.sleepycat.collections.test.serial;
9
10/**
11 * @see StoredClassCatalogTest
12 * @author Mark Hayes
13 */
14class TestSerial implements java.io.Serializable
15{
16    static final long serialVersionUID = -3738980000390384920L;
17
18    private int i = 123;
19    private TestSerial other;
20
21    // The following field 's' was added after this class was compiled and
22    // serialized instances were saved in resource files.  This allows testing
23    // that the original stored instances can be deserialized after changing
24    // the class.  The serialVersionUID is needed for this according to Java
25    // serialization rules, and was generated with the serialver tool.
26    //
27    //private String s = "string";
28
29    TestSerial(TestSerial other)
30    {
31        this.other = other;
32    }
33
34    TestSerial getOther()
35    {
36        return other;
37    }
38
39    int getIntField()
40    {
41        return i;
42    }
43
44    String getStringField()
45    {
46        return null; // this returned null before field 's' was added.
47    }
48
49    public boolean equals(Object object)
50    {
51        try
52        {
53            TestSerial o = (TestSerial) object;
54            if ((o.other == null) ? (this.other != null)
55                                  : (!o.other.equals(this.other)))
56                return false;
57            if (this.i != o.i)
58                return false;
59            // the following test was not done before field 's' was added
60            /*
61            if ((o.s == null) ? (this.s != null)
62                              : (!o.s.equals(this.s)))
63                return false;
64            */
65            return true;
66        }
67        catch (ClassCastException e)
68        {
69            return false;
70        }
71    }
72}
73