Here you can find the source of isSerializable(Object o)
public static boolean isSerializable(Object o) throws IOException
//package com.java2s; /*//from ww w.j av a 2 s . c o m * The Spring Framework is published under the terms * of the Apache Software License. */ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectOutputStream; import java.io.OutputStream; public class Main { public static boolean isSerializable(Object o) throws IOException { try { testSerialization(o); return true; } catch (NotSerializableException ex) { return false; } } public static void testSerialization(Object o) throws IOException { OutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); } }