Polishing
This commit is contained in:
@@ -186,7 +186,7 @@ public final class ResolvableType implements Serializable {
|
|||||||
* whether both the {@link #resolve() resolved} {@code Class} is
|
* whether both the {@link #resolve() resolved} {@code Class} is
|
||||||
* {@link Class#isAssignableFrom(Class) assignable from} the given type
|
* {@link Class#isAssignableFrom(Class) assignable from} the given type
|
||||||
* as well as whether all {@link #getGenerics() generics} are assignable.
|
* as well as whether all {@link #getGenerics() generics} are assignable.
|
||||||
* @param other the type to be checked against
|
* @param other the type to be checked against (as a {@code ResolvableType})
|
||||||
* @return {@code true} if the specified other type can be assigned to this
|
* @return {@code true} if the specified other type can be assigned to this
|
||||||
* {@code ResolvableType}; {@code false} otherwise
|
* {@code ResolvableType}; {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
@@ -349,7 +349,7 @@ public final class ResolvableType implements Serializable {
|
|||||||
* implement or extend the specified class.
|
* implement or extend the specified class.
|
||||||
* @param type the required class type
|
* @param type the required class type
|
||||||
* @return a {@link ResolvableType} representing this object as the specified
|
* @return a {@link ResolvableType} representing this object as the specified
|
||||||
* type or {@link #NONE}
|
* type, or {@link #NONE} if not resolvable as that type
|
||||||
* @see #asCollection()
|
* @see #asCollection()
|
||||||
* @see #asMap()
|
* @see #asMap()
|
||||||
* @see #getSuperType()
|
* @see #getSuperType()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -111,7 +111,7 @@ public class TypeDescriptor implements Serializable {
|
|||||||
* constructor is used internally and may also be used by subclasses that support
|
* constructor is used internally and may also be used by subclasses that support
|
||||||
* non-Java languages with extended type systems.
|
* non-Java languages with extended type systems.
|
||||||
* @param resolvableType the resolvable type
|
* @param resolvableType the resolvable type
|
||||||
* @param type the backing type or {@code null} if should be resolved
|
* @param type the backing type (or {@code null} if it should get resolved)
|
||||||
* @param annotations the type annotations
|
* @param annotations the type annotations
|
||||||
*/
|
*/
|
||||||
protected TypeDescriptor(ResolvableType resolvableType, Class<?> type, Annotation[] annotations) {
|
protected TypeDescriptor(ResolvableType resolvableType, Class<?> type, Annotation[] annotations) {
|
||||||
@@ -194,7 +194,7 @@ public class TypeDescriptor implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Cast this {@link TypeDescriptor} to a superclass or implemented interface
|
* Cast this {@link TypeDescriptor} to a superclass or implemented interface
|
||||||
* preserving annotations and nested type context.
|
* preserving annotations and nested type context.
|
||||||
* @param superType the super type to cast to (can be {@code null}
|
* @param superType the super type to cast to (can be {@code null})
|
||||||
* @return a new TypeDescriptor for the up-cast type
|
* @return a new TypeDescriptor for the up-cast type
|
||||||
* @throws IllegalArgumentException if this type is not assignable to the super-type
|
* @throws IllegalArgumentException if this type is not assignable to the super-type
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -23,7 +23,8 @@ import java.io.ObjectInputStream;
|
|||||||
import org.springframework.core.NestedIOException;
|
import org.springframework.core.NestedIOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserializer that reads an input stream using Java Serialization.
|
* A default {@link Deserializer} implementation that reads an input stream
|
||||||
|
* using Java serialization.
|
||||||
*
|
*
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
* @author Mark Fisher
|
* @author Mark Fisher
|
||||||
@@ -33,6 +34,7 @@ public class DefaultDeserializer implements Deserializer<Object> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the input stream and deserializes into an object.
|
* Reads the input stream and deserializes into an object.
|
||||||
|
* @see ObjectInputStream#readObject()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object deserialize(InputStream inputStream) throws IOException {
|
public Object deserialize(InputStream inputStream) throws IOException {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -22,7 +22,8 @@ import java.io.OutputStream;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializer that writes an object to an output stream using Java Serialization.
|
* A {@link Serializer} implementation that writes an object to an output stream
|
||||||
|
* using Java serialization.
|
||||||
*
|
*
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
* @author Mark Fisher
|
* @author Mark Fisher
|
||||||
@@ -31,8 +32,9 @@ import java.io.Serializable;
|
|||||||
public class DefaultSerializer implements Serializer<Object> {
|
public class DefaultSerializer implements Serializer<Object> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes the source object to an output stream using Java Serialization.
|
* Writes the source object to an output stream using Java serialization.
|
||||||
* The source object must implement {@link Serializable}.
|
* The source object must implement {@link Serializable}.
|
||||||
|
* @see ObjectOutputStream#writeObject(Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void serialize(Object object, OutputStream outputStream) throws IOException {
|
public void serialize(Object object, OutputStream outputStream) throws IOException {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -24,7 +24,8 @@ import org.springframework.core.serializer.Deserializer;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Converter} that delegates to a {@link org.springframework.core.serializer.Deserializer}
|
* A {@link Converter} that delegates to a
|
||||||
|
* {@link org.springframework.core.serializer.Deserializer}
|
||||||
* to convert data in a byte array to an object.
|
* to convert data in a byte array to an object.
|
||||||
*
|
*
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
@@ -37,14 +38,15 @@ public class DeserializingConverter implements Converter<byte[], Object> {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a default DeserializingConverter that uses standard Java deserialization.
|
* Create a {@code DeserializingConverter} with default {@link java.io.ObjectInputStream}
|
||||||
|
* configuration, using the "latest user-defined ClassLoader".
|
||||||
*/
|
*/
|
||||||
public DeserializingConverter() {
|
public DeserializingConverter() {
|
||||||
this.deserializer = new DefaultDeserializer();
|
this.deserializer = new DefaultDeserializer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a DeserializingConverter that delegates to the provided {@link Deserializer}.
|
* Create a {@code DeserializingConverter} that delegates to the provided {@link Deserializer}.
|
||||||
*/
|
*/
|
||||||
public DeserializingConverter(Deserializer<Object> deserializer) {
|
public DeserializingConverter(Deserializer<Object> deserializer) {
|
||||||
Assert.notNull(deserializer, "Deserializer must not be null");
|
Assert.notNull(deserializer, "Deserializer must not be null");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -24,7 +24,8 @@ import org.springframework.core.serializer.Serializer;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Converter} that delegates to a {@link org.springframework.core.serializer.Serializer}
|
* A {@link Converter} that delegates to a
|
||||||
|
* {@link org.springframework.core.serializer.Serializer}
|
||||||
* to convert an object to a byte array.
|
* to convert an object to a byte array.
|
||||||
*
|
*
|
||||||
* @author Gary Russell
|
* @author Gary Russell
|
||||||
@@ -37,14 +38,14 @@ public class SerializingConverter implements Converter<Object, byte[]> {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a default SerializingConverter that uses standard Java serialization.
|
* Create a default {@code SerializingConverter} that uses standard Java serialization.
|
||||||
*/
|
*/
|
||||||
public SerializingConverter() {
|
public SerializingConverter() {
|
||||||
this.serializer = new DefaultSerializer();
|
this.serializer = new DefaultSerializer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a SerializingConverter that delegates to the provided {@link Serializer}
|
* Create a {@code SerializingConverter} that delegates to the provided {@link Serializer}.
|
||||||
*/
|
*/
|
||||||
public SerializingConverter(Serializer<Object> serializer) {
|
public SerializingConverter(Serializer<Object> serializer) {
|
||||||
Assert.notNull(serializer, "Serializer must not be null");
|
Assert.notNull(serializer, "Serializer must not be null");
|
||||||
@@ -57,7 +58,7 @@ public class SerializingConverter implements Converter<Object, byte[]> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public byte[] convert(Object source) {
|
public byte[] convert(Object source) {
|
||||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(256);
|
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(1024);
|
||||||
try {
|
try {
|
||||||
this.serializer.serialize(source, byteStream);
|
this.serializer.serialize(source, byteStream);
|
||||||
return byteStream.toByteArray();
|
return byteStream.toByteArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user