aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2010-03-09 16:39:57 +0000
committerArtur Signell <artur.signell@itmill.com>2010-03-09 16:39:57 +0000
commit748eb5b96566797872fb0f25b427739a70d5e15e (patch)
tree36c97bfaaf6e14c0dc188a2820bf2f1536236dae
parent92ff35ef896461d6053ede69bd1b74bd983e9d3f (diff)
downloadvaadin-framework-748eb5b96566797872fb0f25b427739a70d5e15e.tar.gz
vaadin-framework-748eb5b96566797872fb0f25b427739a70d5e15e.zip
Added javadoc
svn changeset:11729/svn branch:6.3
-rw-r--r--src/com/vaadin/util/SerializerHelper.java66
1 files changed, 65 insertions, 1 deletions
diff --git a/src/com/vaadin/util/SerializerHelper.java b/src/com/vaadin/util/SerializerHelper.java
index fe9eb28918..2e9bcb422e 100644
--- a/src/com/vaadin/util/SerializerHelper.java
+++ b/src/com/vaadin/util/SerializerHelper.java
@@ -6,11 +6,24 @@ import java.io.ObjectOutputStream;
/**
* Helper class for performing serialization. Most of the methods are here are
- * workarounds for problems in Google App Engine.
+ * workarounds for problems in Google App Engine. Used internally by Vaadin and
+ * should not be used by application developers. Subject to change at any time.
*
+ * @since 6.0
*/
public class SerializerHelper {
+ /**
+ * Serializes the class reference so {@link #readClass(ObjectInputStream)}
+ * can deserialize it. Supports null class references.
+ *
+ * @param out
+ * The {@link ObjectOutputStream} to serialize to.
+ * @param cls
+ * A class or null.
+ * @throws IOException
+ * Rethrows any IOExceptions from the ObjectOutputStream
+ */
public static void writeClass(ObjectOutputStream out, Class<?> cls)
throws IOException {
if (cls == null) {
@@ -21,6 +34,18 @@ public class SerializerHelper {
}
+ /**
+ * Serializes the class references so
+ * {@link #readClassArray(ObjectInputStream)} can deserialize it. Supports
+ * null class arrays.
+ *
+ * @param out
+ * The {@link ObjectOutputStream} to serialize to.
+ * @param classes
+ * An array containing class references or null.
+ * @throws IOException
+ * Rethrows any IOExceptions from the ObjectOutputStream
+ */
public static void writeClassArray(ObjectOutputStream out,
Class<?>[] classes) throws IOException {
if (classes == null) {
@@ -34,6 +59,19 @@ public class SerializerHelper {
}
}
+ /**
+ * Deserializes a class references serialized by
+ * {@link #writeClassArray(ObjectOutputStream, Class[])}. Supports null
+ * class arrays.
+ *
+ * @param in
+ * {@link ObjectInputStream} to read from.
+ * @return Class array with the class references or null.
+ * @throws ClassNotFoundException
+ * If one of the classes could not be resolved.
+ * @throws IOException
+ * Rethrows IOExceptions from the ObjectInputStream
+ */
public static Class<?>[] readClassArray(ObjectInputStream in)
throws ClassNotFoundException, IOException {
String[] classNames = (String[]) in.readObject();
@@ -48,10 +86,23 @@ public class SerializerHelper {
return classes;
}
+ /**
+ * List of primitive classes. Google App Engine has problems
+ * serializing/deserializing these (#3064).
+ */
private static Class<?>[] primitiveClasses = new Class<?>[] { byte.class,
short.class, int.class, long.class, float.class, double.class,
boolean.class, char.class };
+ /**
+ * Resolves the class given by {@code className}.
+ *
+ * @param className
+ * The fully qualified class name.
+ * @return A {@code Class} reference.
+ * @throws ClassNotFoundException
+ * If the class could not be resolved.
+ */
public static Class<?> resolveClass(String className)
throws ClassNotFoundException {
for (Class<?> c : primitiveClasses) {
@@ -63,6 +114,19 @@ public class SerializerHelper {
return Class.forName(className);
}
+ /**
+ * Deserializes a class reference serialized by
+ * {@link #writeClass(ObjectOutputStream, Class)}. Supports null class
+ * references.
+ *
+ * @param in
+ * {@code ObjectInputStream} to read from.
+ * @return Class reference to the resolved class
+ * @throws ClassNotFoundException
+ * If the class could not be resolved.
+ * @throws IOException
+ * Rethrows IOExceptions from the ObjectInputStream
+ */
public static Class<?> readClass(ObjectInputStream in) throws IOException,
ClassNotFoundException {
String className = (String) in.readObject();