Skip to content

Commit 1837986

Browse files
Making objects serializable
1 parent 7dab1a5 commit 1837986

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/main/java/com/cloud/internal/json/JSONArray.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
2626
*/
2727

2828
import java.io.IOException;
29+
import java.io.Serializable;
2930
import java.io.StringWriter;
3031
import java.io.Writer;
3132
import java.lang.reflect.Array;
@@ -78,9 +79,9 @@ of this software and associated documentation files (the "Software"), to deal
7879
* @author JSON.org
7980
* @version 2013-04-18
8081
*/
81-
public class JSONArray {
82+
public class JSONArray implements Serializable {
8283

83-
/**
84+
/**
8485
* The arrayList where the JSONArray's properties are kept.
8586
*/
8687
private final ArrayList myArrayList;
@@ -942,4 +943,7 @@ Writer write(Writer writer, int indentFactor, int indent)
942943
throw new JSONException(e);
943944
}
944945
}
946+
947+
private static final long serialVersionUID = -9029420148556494629L;
948+
945949
}

src/main/java/com/cloud/internal/json/JSONObject.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
2626
*/
2727

2828
import java.io.IOException;
29+
import java.io.Serializable;
2930
import java.io.StringWriter;
3031
import java.io.Writer;
3132
import java.lang.reflect.Field;
@@ -93,8 +94,9 @@ of this software and associated documentation files (the "Software"), to deal
9394
* @author JSON.org
9495
* @version 2013-06-17
9596
*/
96-
public class JSONObject {
97-
/**
97+
public class JSONObject implements Serializable {
98+
99+
/**
98100
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
99101
* whilst Java's null is equivalent to the value that JavaScript calls
100102
* undefined.
@@ -1639,4 +1641,7 @@ Writer write(Writer writer, int indentFactor, int indent)
16391641
throw new JSONException(exception);
16401642
}
16411643
}
1644+
1645+
private static final long serialVersionUID = 8790184474158900049L;
1646+
16421647
}

0 commit comments

Comments
 (0)