File tree 2 files changed +22
-1
lines changed
main/java/org/springframework/core/convert
test/java/org/springframework/core/convert
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .core .convert ;
18
18
19
+ import java .io .Serializable ;
19
20
import java .lang .annotation .Annotation ;
20
21
import java .lang .reflect .Array ;
21
22
import java .lang .reflect .Field ;
38
39
* @author Sam Brannen
39
40
* @since 3.0
40
41
*/
41
- public class TypeDescriptor {
42
+ public class TypeDescriptor implements Serializable {
43
+
44
+ private static final long serialVersionUID = 1L ;
45
+
42
46
43
47
static final Annotation [] EMPTY_ANNOTATION_ARRAY = new Annotation [0 ];
44
48
Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .core .convert ;
18
18
19
+ import java .io .ByteArrayInputStream ;
20
+ import java .io .ByteArrayOutputStream ;
21
+ import java .io .ObjectInputStream ;
22
+ import java .io .ObjectOutputStream ;
19
23
import java .lang .annotation .ElementType ;
20
24
import java .lang .annotation .Retention ;
21
25
import java .lang .annotation .RetentionPolicy ;
32
36
import org .junit .Test ;
33
37
import org .springframework .core .MethodParameter ;
34
38
39
+ import static org .hamcrest .Matchers .*;
35
40
import static org .junit .Assert .*;
36
41
37
42
/**
@@ -870,4 +875,16 @@ public void createStringArray() throws Exception {
870
875
public void createNullArray () throws Exception {
871
876
assertNull (TypeDescriptor .array (null ));
872
877
}
878
+
879
+ @ Test
880
+ public void serializable () throws Exception {
881
+ TypeDescriptor typeDescriptor = TypeDescriptor .forObject ("" );
882
+ ByteArrayOutputStream out = new ByteArrayOutputStream ();
883
+ ObjectOutputStream outputStream = new ObjectOutputStream (out );
884
+ outputStream .writeObject (typeDescriptor );
885
+ ObjectInputStream inputStream = new ObjectInputStream (new ByteArrayInputStream (
886
+ out .toByteArray ()));
887
+ TypeDescriptor readObject = (TypeDescriptor ) inputStream .readObject ();
888
+ assertThat (readObject , equalTo (typeDescriptor ));
889
+ }
873
890
}
You can’t perform that action at this time.
0 commit comments