parent
9939c4809b
commit
9eb596a7e5
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.core.convert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -38,7 +39,10 @@ import org.springframework.util.ObjectUtils;
|
|||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
*/
|
||||
public class TypeDescriptor {
|
||||
public class TypeDescriptor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
|
||||
package org.springframework.core.convert;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
@ -32,6 +36,7 @@ import java.util.Map;
|
|||
import org.junit.Test;
|
||||
import org.springframework.core.MethodParameter;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
|
@ -870,4 +875,16 @@ public class TypeDescriptorTests {
|
|||
public void createNullArray() throws Exception {
|
||||
assertNull(TypeDescriptor.array(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializable() throws Exception {
|
||||
TypeDescriptor typeDescriptor = TypeDescriptor.forObject("");
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ObjectOutputStream outputStream = new ObjectOutputStream(out);
|
||||
outputStream.writeObject(typeDescriptor);
|
||||
ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(
|
||||
out.toByteArray()));
|
||||
TypeDescriptor readObject = (TypeDescriptor) inputStream.readObject();
|
||||
assertThat(readObject, equalTo(typeDescriptor));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue