Java Is Serializable Object isSerializable(Class c)

Here you can find the source of isSerializable(Class c)

Description

Returns true if a class implements Serializable and false otherwise.

License

Open Source License

Parameter

Parameter Description
c the class.

Return

A boolean.

Declaration

public static boolean isSerializable(Class c) 

Method Source Code

//package com.java2s;
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version./*  w w w.j  a  v  a2  s .c o  m*/
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA.
 *
 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
 * Other names may be trademarks of their respective owners.]
 * 
 * ----------------
 * SerialUtils.java
 * ----------------
 * (C) Copyright 2000-2014, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   Arik Levin;
 *
 * Changes
 * -------
 * 25-Mar-2003 : Version 1 (DG);
 * 18-Sep-2003 : Added capability to serialize GradientPaint (DG);
 * 26-Apr-2004 : Added read/writePoint2D() methods (DG);
 * 22-Feb-2005 : Added support for Arc2D - see patch 1147035 by Arik Levin (DG);
 * 29-Jul-2005 : Added support for AttributedString (DG);
 * 10-Oct-2011 : Added support for AlphaComposite instances (MH);
 *
 */

import java.io.Serializable;

public class Main {
    /**
     * Returns {@code true} if a class implements {@code Serializable}
     * and {@code false} otherwise.
     *
     * @param c  the class.
     *
     * @return A boolean.
     */
    public static boolean isSerializable(Class c) {
        return (Serializable.class.isAssignableFrom(c));
    }
}

Related

  1. isSerializable(Class clazz)
  2. isSerializable(Class clazz)
  3. isSerializable(final Object c)
  4. isSerializable(Object o)