ApiGenerator
//传统方式接口编写public class LoginApi { public ICall login(String username, String password, int age, CallbackList.IRemoteCompletedCallback<User> callback) { Map<String, Object> params = new HashMap(); params.put("username", username); params.put("password", password); params.put("age", age); return EasyRemote.getRemote() .method(MethodEnum.POST) .apiAndVersionIs("http://www.baidu.com", "1") .needCache(true) .parameterIs(params) .asyncCall(callback); } public int queryUser(String username, String password, int age, IRemoteCallback callback) throws Exception { Map<String, Object> params = new HashMap(); params.put("username", username); params.put("password", password); params.put("age", age); EasyRemote.getRemote() .method(MethodEnum.POST) .apiAndVersionIs("http://www.baidu.com", "1") .needCache(true) .parameterIs(params) .asyncCall(callback); return 0; }}
//ApiGenerator方式接口编写@MWPpublic interface LoginApi { @Api( api = "http://www.baidu.com", version = "1" ) ICall login(String username, String password, int age, @Callback CallbackList.IRemoteCompletedCallback<User> callback); @Api( api = "http://www.baidu.com", version = "1", method = "POST", needCache = true ) int queryUser(String username, String password, int age, @Callback IRemoteCallback callback) throws Exception;}