You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
724 B
28 lines
724 B
package com.gyf.csams.util
|
|
|
|
import com.google.gson.Gson
|
|
import com.google.gson.GsonBuilder
|
|
import com.gyf.csams.association.model.Exam
|
|
import com.gyf.csams.module.ApiResponse
|
|
import com.gyf.lib.util.HttpCallback
|
|
import java.lang.reflect.Type
|
|
|
|
/**
|
|
* http请求回调
|
|
*
|
|
* @param T
|
|
* @property action
|
|
* @property onSuccess
|
|
* @property onFail
|
|
|
|
*/
|
|
class ExamCallback<T>(
|
|
private val action: String,
|
|
private val onSuccess: (res: ApiResponse<T>) -> Unit,
|
|
private val onFail: (error: String) -> Unit,
|
|
private val type: Type
|
|
) : HttpCallback<T>(action, onSuccess, onFail, type) {
|
|
override val gson: Gson = GsonBuilder()
|
|
.registerTypeAdapter(Exam::class.java, ExamDeserializer())
|
|
.create()
|
|
} |