Here you can find the source of isSerializableType(Class> type)
Parameter | Description |
---|---|
type | the type |
public static boolean isSerializableType(Class<?> type)
//package com.java2s; import java.io.Serializable; public class Main { /**//from www.j a va 2 s . c o m * Checks if is serializable type. * * @param type the type * @return true, if is serializable type */ public static boolean isSerializableType(Class<?> type) { if (Void.class.isAssignableFrom(type)) { return true; } if (Object.class.isAssignableFrom(type) && !Serializable.class.isAssignableFrom(type)) { return false; } return true; } /** * Checks if is serializable type. * * @param types the types * @return true, if is serializable type */ public static boolean isSerializableType(Class<?>... types) { if (null == types || types.length == 0) { return true; } for (Class<?> type : types) { if (!isSerializableType(type)) { return false; } } return true; } }