1 /* 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package failureAtomicity.bar.bar; 24 25 import java.io.Serializable; 26 import failureAtomicity.Expose; 27 28 // foo.foo.HomeAddress and bar.bar.HomeAddress are identical, other than the 29 // type of their zebra field. 30 31 public final class HomeAddress extends Address implements Serializable { 32 static final long serialVersionUID = -0L; 33 34 public final int houseNumber; 35 public final byte[] zebra; // ordered alphabetically, must be last 36 37 public HomeAddress(int houseNumber, String city, String county, String country, byte[] zebra) { 38 super(city, county, country); 39 this.houseNumber = houseNumber; 40 this.zebra = zebra; 41 } 42 43 @Override 44 public String toString() { 45 return new StringBuilder() 46 .append("houseNumber:").append(houseNumber) 47 .append(", city:").append(city) 48 .append(", county:").append(county) 49 .append(", country:").append(country) 50 .append(", zebra:").append(zebra) 51 .toString(); 52 } 53 } 54 55 class Address implements Serializable { 56 static final long serialVersionUID = -0L; 57 58 public final String city; 59 public final String county; 60 public final String country; 61 public final Expose expose; // So we can retrieve a reference to check 62 63 public Address(String city, String county, String country) { 64 this.country = country; 65 this.city = city; 66 this.county = county; 67 this.expose = new Expose(this); 68 } 69 }