public static boolean isAssignableValue(Class<?> type, Object value) {
        if (value == null) {
            return !type.isPrimitive();
        }
        Class<?> valueType = value.getClass();
        if (type.isArray() || valueType.isArray()) {
            if ((type.isArray() && valueType.isArray())) {
                int len = Array.getLength(value);
                if (len == 0) {
                    return true;
                } else {
                    Object first = Array.get(value, 0);
                    return isAssignableValue(type.getComponentType(), first);
                }
            }
        } else {
            if (type.isInstance(value)) {
                return true;
            }
            if (valueType.isPrimitive() && !type.isPrimitive() && type.equals(getPrimitiveWrapper(valueType))) {
                return true;
            }
            if (type.isPrimitive() && !valueType.isPrimitive() && valueType.equals(getPrimitiveWrapper(type))) {
                return true;
            }
        }
        return false;
    }
public static boolean isAssignableValue ( Class < ? > type , Object value ) { if ( value == null ) { return ! type . isPrimitive ( ) ; } Class < ? > valueType = value . getClass ( ) ; if ( type . isArray ( ) || valueType . isArray ( ) ) { if ( ( type . isArray ( ) && valueType . isArray ( ) ) ) { int len = Array . getLength ( value ) ; if ( len == 0 ) { return true ; } else { Object first = Array . get ( value , 0 ) ; return isAssignableValue ( type . getComponentType ( ) , first ) ; } } } else { if ( type . isInstance ( value ) ) { return true ; } if ( valueType . isPrimitive ( ) && ! type . isPrimitive ( ) && type . equals ( getPrimitiveWrapper ( valueType ) ) ) { return true ; } if ( type . isPrimitive ( ) && ! valueType . isPrimitive ( ) && valueType . equals ( getPrimitiveWrapper ( type ) ) ) { return true ; } } return false ; }
Determine if the given type is assignable from the given value,
assuming setting by reflection. Considers primitive wrapper classes
as assignable to the corresponding primitive types.

@param type    the target type
@param value the value that should be assigned to the type
@return if the type is assignable from the value