Check whether a class can be serialized or deserialized. It can check
based on packages, annotations on entities or explicit classes.

@param type class need to check
@return true if valid
761510
protected boolean isValidType(Class<?> type, Annotation[] classAnnotations) {
		if (type == null)
			return false;
		
		if (annotated) {
			return checkAnnotation(type);			
		} else if (scanpackages != null) {
			String classPackage = type.getPackage().getName();
			for (String pkg : scanpackages) {
				if (classPackage.startsWith(pkg)) {
					if (annotated) {
						return checkAnnotation(type);		
					} else
						return true;
				}
					
			}

			return false;
		} else if (clazzes != null) {
			for (Class<?> cls : clazzes) { // must strictly equal. Don't check
											// inheritance
				if (cls == type)
					return true;
			}

			return false;
		}

		return true;
	}
121053
public boolean hasException(Class<? extends Throwable> type) {
        for (Throwable exception : exceptions) {
            if (type.isInstance(exception)) {
                return true;
            }
        }
        
        return false;
    }
603169
public boolean supports(final AbstractType<?> type) {
        AbstractType<?> checkedType = type;
        if (type.isCollection()) {
            if (type instanceof MapType<?, ?>) {
                checkedType = ((MapType<?, ?>) type).getValuesType();
            } else if (type instanceof ListType<?>) {
                checkedType = ((ListType<?>) type).getElementsType();
            } else if (type instanceof SetType) {
                checkedType = ((SetType<?>) type).getElementsType();
            }
        }

        if (type instanceof ReversedType) {
            ReversedType reversedType = (ReversedType) type;
            checkedType = reversedType.baseType;
        }

        for (AbstractType<?> n : supportedTypes) {
            if (checkedType.getClass() == n.getClass()) {
                return true;
            }
        }
        return false;
    }
581584
def is_serializable_type(type_):
    
    if not inspect.isclass(type_):
      return Serializable.is_serializable(type_)
    return issubclass(type_, Serializable) or hasattr(type_, '_asdict')
288760
public static boolean isGeneratedClass(Class<?> type) {
        return null != type && type != GeneratedClass.class
                && GeneratedClass.class.isAssignableFrom(type);
    }
1022875
private static boolean isSupportedEntity(Class<?> entityType) {
        try {
            Annotation annotation = entityType.getAnnotation(Serializer.class);
            if (annotation != null) {
                return true;
            }
        } catch (Throwable th) {
            LOGGER.warn("Exception in checking for annotations", th);
        }
        return false;
    }
571921
public static boolean isConvertibleToPublisher(Class<?> type) {
        if (Publisher.class.isAssignableFrom(type)) {
            return true;
        } else {
            for (Class<?> reactiveType : REACTIVE_TYPES) {
                if (reactiveType.isAssignableFrom(type)) {
                    return true;
                }
            }
            return false;
        }
    }
928243
public boolean isWritable(Class<?> type) {
        return Finder.class.isAssignableFrom(type)
                || Query.class.isAssignableFrom(type)
                || ExpressionList.class.isAssignableFrom(type)
                || FutureList.class.isAssignableFrom(type);
    }
1217249
public static boolean isPrimitive(Type type) {
        return type.equals(boolean.class)
                || type.equals(double.class)
                || type.equals(float.class)
                || type.equals(short.class)
                || type.equals(int.class)
                || type.equals(long.class)
                || type.equals(byte.class)
                || type.equals(char.class);
    }
189867
public static boolean isOptional(final Type type) {
        if (OPTIONAL_CLASS == null) {
            return false;
        }

        if (!(type instanceof ParameterizedType)) {
            // Either this is no Optional, or it's a raw optional which is useless for us anyway...
            return false;
        }

        return OPTIONAL_CLASS.equals(((ParameterizedType) type).getRawType());
    }
793361
public static boolean isInstantiable(Class<?> type)
   {
      if (type != null)
      {
         try
         {
            if (type.isInterface())
               return true;
            type.getConstructor();
            return true;
         }
         catch (SecurityException e)
         {
            return false;
         }
         catch (NoSuchMethodException e)
         {
            return false;
         }
      }
      return false;
   }
318338
public static boolean isClass(LightweightTypeReference typeRef) {
		final JvmType t = typeRef.getType();
		if (t instanceof JvmGenericType) {
			return !((JvmGenericType) t).isInterface();
		}
		return false;
	}
367002
private boolean isReactive(Type type) {
    if (!ParameterizedType.class.isAssignableFrom(type.getClass())) {
      return false;
    }
    ParameterizedType parameterizedType = (ParameterizedType) type;
    Type raw = parameterizedType.getRawType();
    return Arrays.asList(((Class) raw).getInterfaces())
        .contains(Publisher.class);
  }
68413
public static boolean isAssignableFrom(Type from, Class<?> to) {
    return TypeVisitor.of(from, b -> b
        .onClass(to::isAssignableFrom)
        .onParameterizedType(pt -> TypeVisitor.of(pt.getRawType(), bb -> bb
            .onClass(to::isAssignableFrom)
            .result()))
        .onTypeVariable(tv -> isAssignableFrom(tv.getBounds(), to))
        .onWildcardType(tv -> isAssignableFrom(tv.getUpperBounds(), to))
        .result());
  }
251027
public static boolean isIntCategory(ClassNode type) {
        return  type==byte_TYPE     ||  type==char_TYPE     ||
                type==int_TYPE      ||  type==short_TYPE;
    }
167687
public static boolean isJdkImmutable(Class<?> type) {
        
    	if (Class.class == type) {
    		return true;
    	}
        if (String.class == type) {
            return true;
        }
        if (BigInteger.class == type) {
            return true;
        }
        if (BigDecimal.class == type) {
            return true;
        }
        if (URL.class == type) {
            return true;
        }
        if (UUID.class == type) {
            return true;
        }
        if (URI.class == type) {
            return true;
        }
        if (Pattern.class == type) {
            return true;
        }
        return false;
    }
1019269
public static Condition<?, ?> isType(final Class<?> type) {
    return new Condition<Object, Object>() {
      public boolean applies(MappingContext<Object, Object> context) {
        return type.isAssignableFrom(context.getSourceType());
      }
    };
  }