From 566ea301673e6ef9a8a6617b5ff2071167a30db2 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 31 Aug 2015 17:32:33 +0200 Subject: [PATCH] Polishing --- .../java/org/springframework/core/ResolvableType.java | 2 +- .../springframework/core/convert/TypeDescriptor.java | 2 +- .../core/serializer/DefaultSerializer.java | 8 +++++--- .../core/serializer/support/SerializingConverter.java | 11 ++++++----- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/ResolvableType.java b/spring-core/src/main/java/org/springframework/core/ResolvableType.java index b3e8c4dbb6..07da8f214c 100644 --- a/spring-core/src/main/java/org/springframework/core/ResolvableType.java +++ b/spring-core/src/main/java/org/springframework/core/ResolvableType.java @@ -389,7 +389,7 @@ public class ResolvableType implements Serializable { * implement or extend the specified class. * @param type the required class type * @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 #asMap() * @see #getSuperType() diff --git a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java index 45ef411029..586cb83902 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java +++ b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java @@ -201,7 +201,7 @@ public class TypeDescriptor implements Serializable { /** * Cast this {@link TypeDescriptor} to a superclass or implemented interface * 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 * @throws IllegalArgumentException if this type is not assignable to the super-type * @since 3.2 diff --git a/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java b/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java index 6146ee018c..d8769bf9fa 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/DefaultSerializer.java @@ -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"); * you may not use this file except in compliance with the License. @@ -22,7 +22,8 @@ import java.io.OutputStream; 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 Mark Fisher @@ -31,8 +32,9 @@ import java.io.Serializable; public class DefaultSerializer implements Serializer { /** - * 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}. + * @see ObjectOutputStream#writeObject(Object) */ @Override public void serialize(Object object, OutputStream outputStream) throws IOException { diff --git a/spring-core/src/main/java/org/springframework/core/serializer/support/SerializingConverter.java b/spring-core/src/main/java/org/springframework/core/serializer/support/SerializingConverter.java index 1a35c6a2b5..954a9681fd 100644 --- a/spring-core/src/main/java/org/springframework/core/serializer/support/SerializingConverter.java +++ b/spring-core/src/main/java/org/springframework/core/serializer/support/SerializingConverter.java @@ -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"); * 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; /** - * 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. * * @author Gary Russell @@ -37,14 +38,14 @@ public class SerializingConverter implements Converter { /** - * Create a default SerializingConverter that uses standard Java serialization. + * Create a default {@code SerializingConverter} that uses standard Java serialization. */ public SerializingConverter() { 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 serializer) { Assert.notNull(serializer, "Serializer must not be null"); @@ -57,7 +58,7 @@ public class SerializingConverter implements Converter { */ @Override public byte[] convert(Object source) { - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(256); + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(1024); try { this.serializer.serialize(source, byteStream); return byteStream.toByteArray();