Skip to content

Commit cc741cd

Browse files
committed
Polishing
1 parent 8daa932 commit cc741cd

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

spring-core/src/main/java/org/springframework/core/ResolvableType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public Object getSource() {
186186
* whether both the {@link #resolve() resolved} {@code Class} is
187187
* {@link Class#isAssignableFrom(Class) assignable from} the given type
188188
* as well as whether all {@link #getGenerics() generics} are assignable.
189-
* @param other the type to be checked against
189+
* @param other the type to be checked against (as a {@code ResolvableType})
190190
* @return {@code true} if the specified other type can be assigned to this
191191
* {@code ResolvableType}; {@code false} otherwise
192192
*/
@@ -349,7 +349,7 @@ public ResolvableType asMap() {
349349
* implement or extend the specified class.
350350
* @param type the required class type
351351
* @return a {@link ResolvableType} representing this object as the specified
352-
* type or {@link #NONE}
352+
* type, or {@link #NONE} if not resolvable as that type
353353
* @see #asCollection()
354354
* @see #asMap()
355355
* @see #getSuperType()

spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,7 +111,7 @@ public TypeDescriptor(Property property) {
111111
* constructor is used internally and may also be used by subclasses that support
112112
* non-Java languages with extended type systems.
113113
* @param resolvableType the resolvable type
114-
* @param type the backing type or {@code null} if should be resolved
114+
* @param type the backing type (or {@code null} if it should get resolved)
115115
* @param annotations the type annotations
116116
*/
117117
protected TypeDescriptor(ResolvableType resolvableType, Class<?> type, Annotation[] annotations) {
@@ -194,7 +194,7 @@ public TypeDescriptor narrow(Object value) {
194194
/**
195195
* Cast this {@link TypeDescriptor} to a superclass or implemented interface
196196
* preserving annotations and nested type context.
197-
* @param superType the super type to cast to (can be {@code null}
197+
* @param superType the super type to cast to (can be {@code null})
198198
* @return a new TypeDescriptor for the up-cast type
199199
* @throws IllegalArgumentException if this type is not assignable to the super-type
200200
* @since 3.2

spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,8 @@
2323
import org.springframework.core.NestedIOException;
2424

2525
/**
26-
* Deserializer that reads an input stream using Java Serialization.
26+
* A default {@link Deserializer} implementation that reads an input stream
27+
* using Java serialization.
2728
*
2829
* @author Gary Russell
2930
* @author Mark Fisher
@@ -33,6 +34,7 @@ public class DefaultDeserializer implements Deserializer<Object> {
3334

3435
/**
3536
* Reads the input stream and deserializes into an object.
37+
* @see ObjectInputStream#readObject()
3638
*/
3739
@Override
3840
public Object deserialize(InputStream inputStream) throws IOException {

spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,8 @@
2222
import java.io.Serializable;
2323

2424
/**
25-
* Serializer that writes an object to an output stream using Java Serialization.
25+
* A {@link Serializer} implementation that writes an object to an output stream
26+
* using Java serialization.
2627
*
2728
* @author Gary Russell
2829
* @author Mark Fisher
@@ -31,8 +32,9 @@
3132
public class DefaultSerializer implements Serializer<Object> {
3233

3334
/**
34-
* Writes the source object to an output stream using Java Serialization.
35+
* Writes the source object to an output stream using Java serialization.
3536
* The source object must implement {@link Serializable}.
37+
* @see ObjectOutputStream#writeObject(Object)
3638
*/
3739
@Override
3840
public void serialize(Object object, OutputStream outputStream) throws IOException {

spring-core/src/main/java/org/springframework/core/serializer/support/DeserializingConverter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,8 @@
2424
import org.springframework.util.Assert;
2525

2626
/**
27-
* A {@link Converter} that delegates to a {@link org.springframework.core.serializer.Deserializer}
27+
* A {@link Converter} that delegates to a
28+
* {@link org.springframework.core.serializer.Deserializer}
2829
* to convert data in a byte array to an object.
2930
*
3031
* @author Gary Russell
@@ -37,14 +38,15 @@ public class DeserializingConverter implements Converter<byte[], Object> {
3738

3839

3940
/**
40-
* Create a default DeserializingConverter that uses standard Java deserialization.
41+
* Create a {@code DeserializingConverter} with default {@link java.io.ObjectInputStream}
42+
* configuration, using the "latest user-defined ClassLoader".
4143
*/
4244
public DeserializingConverter() {
4345
this.deserializer = new DefaultDeserializer();
4446
}
4547

4648
/**
47-
* Create a DeserializingConverter that delegates to the provided {@link Deserializer}.
49+
* Create a {@code DeserializingConverter} that delegates to the provided {@link Deserializer}.
4850
*/
4951
public DeserializingConverter(Deserializer<Object> deserializer) {
5052
Assert.notNull(deserializer, "Deserializer must not be null");

spring-core/src/main/java/org/springframework/core/serializer/support/SerializingConverter.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,8 @@
2424
import org.springframework.util.Assert;
2525

2626
/**
27-
* A {@link Converter} that delegates to a {@link org.springframework.core.serializer.Serializer}
27+
* A {@link Converter} that delegates to a
28+
* {@link org.springframework.core.serializer.Serializer}
2829
* to convert an object to a byte array.
2930
*
3031
* @author Gary Russell
@@ -37,14 +38,14 @@ public class SerializingConverter implements Converter<Object, byte[]> {
3738

3839

3940
/**
40-
* Create a default SerializingConverter that uses standard Java serialization.
41+
* Create a default {@code SerializingConverter} that uses standard Java serialization.
4142
*/
4243
public SerializingConverter() {
4344
this.serializer = new DefaultSerializer();
4445
}
4546

4647
/**
47-
* Create a SerializingConverter that delegates to the provided {@link Serializer}
48+
* Create a {@code SerializingConverter} that delegates to the provided {@link Serializer}.
4849
*/
4950
public SerializingConverter(Serializer<Object> serializer) {
5051
Assert.notNull(serializer, "Serializer must not be null");
@@ -57,7 +58,7 @@ public SerializingConverter(Serializer<Object> serializer) {
5758
*/
5859
@Override
5960
public byte[] convert(Object source) {
60-
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(256);
61+
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(1024);
6162
try {
6263
this.serializer.serialize(source, byteStream);
6364
return byteStream.toByteArray();

0 commit comments

Comments
 (0)