org.apache.wicket.core.util.io
Class SerializableChecker

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ObjectOutputStream
          extended by org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream
              extended by org.apache.wicket.core.util.io.SerializableChecker
All Implemented Interfaces:
Closeable, DataOutput, Flushable, ObjectOutput, ObjectStreamConstants

public class SerializableChecker
extends CheckingObjectOutputStream

Utility class that analyzes objects for non-serializable nodes. Construct, then call ObjectOutputStream.writeObject(Object) with the object you want to check. When a non-serializable object is found, a ObjectCheckException is thrown with a message that shows the trace up to the not-serializable object. The exception is thrown for the first non-serializable instance it encounters, so multiple problems will not be shown.

Author:
eelcohillenius, Al Maw

Nested Class Summary
static class SerializableChecker.ObjectSerializationChecker
          An implementation of IObjectChecker that checks whether the object implements Serializable interface
static class SerializableChecker.WicketNotSerializableException
          Deprecated. ObjectCheckException is thrown instead
 
Nested classes/interfaces inherited from class org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream
CheckingObjectOutputStream.ObjectCheckException
 
Nested classes/interfaces inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField
 
Field Summary
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
SerializableChecker(NotSerializableException exception)
          Constructor.
SerializableChecker(OutputStream outputStream, NotSerializableException exception)
          Constructor.
 
Method Summary
static boolean isAvailable()
          Deprecated. Use ObjectChecker#isAvailable() instead
 
Methods inherited from class org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream
close, reset, toPrettyPrintedStack, writeObjectOverride
 
Methods inherited from class java.io.ObjectOutputStream
annotateClass, annotateProxyClass, defaultWriteObject, drain, enableReplaceObject, flush, putFields, replaceObject, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeShort, writeStreamHeader, writeUnshared, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializableChecker

public SerializableChecker(NotSerializableException exception)
                    throws IOException
Constructor.

Parameters:
exception - exception that should be set as the cause when throwing a new exception
Throws:
IOException

SerializableChecker

public SerializableChecker(OutputStream outputStream,
                           NotSerializableException exception)
                    throws IOException
Constructor.

Parameters:
exception - exception that should be set as the cause when throwing a new exception
outputStream - the output stream where the serialized object will be written upon successful check
Throws:
IOException
Method Detail

isAvailable

@Deprecated
public static boolean isAvailable()
Deprecated. Use ObjectChecker#isAvailable() instead

Delegate to preserve binary compatibility.

Returns:
true if the checker can be used


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.