All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.iartisan.runtime.api.utils.ApiResUtil Maven / Gradle / Ivy

The newest version!
package org.iartisan.runtime.api.utils;


import org.iartisan.runtime.api.code.ResCodeEnum;
import org.iartisan.runtime.api.res.*;
import org.iartisan.runtime.bean.PageWrapper;
import org.iartisan.runtime.exception.ApiRemoteException;

import java.util.List;

/**
 * 

* res util * * @author King * @since 2018/1/23 */ public class ApiResUtil { public static void getResult(BaseRes t) throws ApiRemoteException { if (!t.getCode().equals(ResCodeEnum.succcess.getCode())) { throw new ApiRemoteException(t); } } public static boolean check(BaseCheckRes t) throws ApiRemoteException { if (!t.getCode().equals(ResCodeEnum.succcess.getCode())) { throw new ApiRemoteException(t); } return t.isResult(); } public static T getBean(BaseOneRes t) throws ApiRemoteException { if (t.getCode().equals(ResCodeEnum.succcess.getCode())) { return t.getDataObject(); } else { throw new ApiRemoteException(t); } } public static List getDataList(BaseListRes t) throws ApiRemoteException { if (t.getCode().equals(ResCodeEnum.succcess.getCode())) { return t.getDataList(); } else { throw new ApiRemoteException(t); } } public static PageWrapper getDataPage(BasePageRes t) throws ApiRemoteException { if (t.getCode().equals(ResCodeEnum.succcess.getCode())) { return t.getDataPage(); } else { throw new ApiRemoteException(t); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy