int classIndex = source.readInt();
if(classIndex == -1) {
return null;
}
if(classIndex < 0 || classIndex >= sAddressClasses.length) {
throw new RuntimeException("Unknown Address type index: " + classIndex);
}
try {
Address address = (Address)sAddressClasses[classIndex].newInstance();
address.readFromParcel(source);
return address;
} catch (InstantiationException e) {
Log.e("AddressParcel", "Default constructor are required on Class"
+ sAddressClasses[classIndex].getName());
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
Log.e("AddressParcel", "Default constructor are required on Class"
+ sAddressClasses[classIndex].getName());
throw new RuntimeException(e);
}