Watch 1 Star 2 Fork 8

刘近冲 / ElegantApache-2.0

forked from 黄海彬 / Elegant 
Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
Java原生的Http网络框架,底层基于HttpNet,动态代理+构建的,致敬Square的Retrofit,同样的用法,不一样的实现! spread retract

Clone or download

#Elegant项目结构如下 输入图片说明



compile 'com.haibin:elegant:1.1.9'


public interface LoginService {
    Call<BaseModel<User>> login(@Form("email") String email,
                                @Form("pwd") String pwd,
                                @Form("versionNum") int versionNum,
                                @Form("dataFrom") int dataFrom);

    // 上传文件                           
    Call<String> postAvatar(@File("portrait") String file);

    Call<String> postJson(@Json String file);
    Call<ResultBean<String>> handUp(@Path("uid") long uid);


public static final String API = "";
public static Elegant elegant = new Elegant();

static {

LoginService service = elegant.from(LoginService.class)
                              .login("", "123456", 2, 2);
                              .execute(new CallBack<BaseModel<User>>() {
                                      public void onResponse(Response<BaseModel<User>> response) {

                                      public void onFailure(Exception e) {



  • Copyright (C) 2013 huanghaibin_dev

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and limitations under the License.

Comments ( 0 )

Sign in for post a comment


Help Search