Кто-нибудь знает решение для отправки в качестве параметра Объект, имеющий Объект, имеет члена?Я пытался сделать что-то вроде этого:
public abstract class ContractObject implements KvmSerializable {
public ContractObject() {
}
public abstract void fill(SoapObject soapObject);
public Object getProperty(int intPropertyIndex) {
Object val = null;
try {
val = this.getClass().getFields()[intPropertyIndex].get(this);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
if(val != null) {
if(val.getClass().isPrimitive()) {
return val;
}
else {
return ((ContractObject) val).toPropertyInfo();
}
} else {
return null;
}
}
public int getPropertyCount() {
return this.getClass().getFields().length;
}
public void getPropertyInfo(int intPropertyIndex, Hashtable arg1, PropertyInfo info) {
Field field = this.getClass().getFields()[intPropertyIndex];
info.name = field.getName();
info.type = field.getType();
}
public void setProperty(int intPropertyIndex, Object objectPropertyNewValue) {
Field field = this.getClass().getFields()[intPropertyIndex];
try {
field.set(this, objectPropertyNewValue);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
public PropertyInfo toPropertyInfo() {
PropertyInfo value = new PropertyInfo();
value.setName(this.getClass().getName());
value.setType(this.getClass());
value.setValue(this);
return value;
}
}
Но это всегда заканчивается некоторыми: java.lang.RuntimeException: Невозможно сериализовать: Клиент: Клиент @ 416802f0
Мой тестовый объект выглядит так:
public class Order extends ContractObject {
public int id;
public Client client;
public SoapArray<ProductType> contentProductType;
public DeliveryType deliveryType;
public PaymentType paiementType;
public boolean isTracked;
public Address deliveryAddress;
public Address billingAddress;
public String comments;
}