我的本地机器有java版本1.8.0_11,服务器有java版本1.8.0_45。
查看对象在两台机器中的序列化方式。
以下结果在服务器计算机上。请参阅到数组。
{
"message": {
"view_content_link": false,
"headers": {
},
"metadata": {
},
"images": [
],
"from_email": "atr@in.com",
"attachments": [
],
"subject": "Test email for 123 123 from local with jar",
"recipient_metadata": [
],
"track_opens": false,
"preserve_recipients": false,
"from_name": "IT",
"tags": [
"1",
"2"
],
"important": false,
"async": true,
"merge": true,
"auto_text": false,
"inline_css": false,
"html": "<h3>test mail<\/h3>",
"text": "text",
"to": [
{
"name": "ABC",
"type": "to",
"email": "atr@it.com"
}
],
"auto_html": false,
"track_clicks": false,
"url_strip_qs": false
},
"key": "adsfadfasdfaf"
}
以下结果在我的本地计算机上。请参阅to array。
{
"message": {
"view_content_link": false,
"headers": {
},
"metadata": {
},
"images": [
],
"from_email": "it@in.com",
"attachments": [
],
"subject": "Test email for 123 123 from local with jar",
"recipient_metadata": [
],
"track_opens": false,
"preserve_recipients": false,
"from_name": "IT",
"tags": [
"1",
"2"
],
"important": false,
"async": true,
"merge": true,
"auto_text": false,
"inline_css": false,
"html": "<h3>test mail<\/h3>",
"text": "text",
"to": [
"{\"name\": \"ABC\", \"type\": \"to\", \"email\": \"atr@it.com\"}"
],
"auto_html": false,
"track_clicks": false,
"url_strip_qs": false
},
"key": "adsfadfasdfaf"
}
代码是
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class Recipient implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4757902777678958032L;
private String email;
private String name;
private String type;
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email
* the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(String type) {
this.type = type;
}
public String toString() {
return "{\"name\": \"" + name + "\", \"type\": \"" + type + "\", \"email\": \"" + email + "\"}";
}
}