Example usage for com.google.gson.reflect TypeToken TypeToken

List of usage examples for com.google.gson.reflect TypeToken TypeToken

Introduction

In this page you can find the example usage for com.google.gson.reflect TypeToken TypeToken.

Prototype

@SuppressWarnings("unchecked")
protected TypeToken() 

Source Link

Document

Constructs a new type literal.

Usage

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Termin> getTermine(Date von, Date bis, Integer anzahl, Integer[] lvkeys)
        throws ApiClientException, ApiServerException {
    List<NameValuePair> params = new ArrayList<NameValuePair>();

    if (von != null) {
        params.add(new BasicNameValuePair("von", von.getTime() + ""));
    }//w w w .j a  v a2 s .  co  m
    if (bis != null) {
        params.add(new BasicNameValuePair("bis", bis.getTime() + ""));
    }
    if (anzahl != null) {
        params.add(new BasicNameValuePair("anzahl", anzahl.toString()));
    }
    if (lvkeys != null && lvkeys.length > 0) {
        params.add(new BasicNameValuePair("lvs", buildArrayParamValue(lvkeys)));
    }

    return get(URL_API_AGENDA_TERMINE, new TypeToken<List<Termin>>() {
    }.getType(), params.toArray(new NameValuePair[0]));
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Semester> getSemester() throws ApiClientException, ApiServerException {
    return get(URL_API_STUDENT_SEMESTERLIST, new TypeToken<List<Semester>>() {
    }.getType());/*from   w  w w  .j a  v a 2s  .  co  m*/
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Studium> getStudien() throws ApiClientException, ApiServerException {
    return get(URL_API_STUDENT_STUDIEN, new TypeToken<List<Studium>>() {
    }.getType());//from  w w  w . j  a v a2s.com
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Lehrveranstaltung> getLehrveranstaltungen(String semester)
        throws ApiClientException, ApiServerException {
    NameValuePair[] params = null;
    if (semester != null) {
        params = new BasicNameValuePair[] { new BasicNameValuePair("semester", semester) };
    }/*  w  ww . ja va  2  s.co  m*/
    return get(URL_API_LVS, new TypeToken<List<Lehrveranstaltung>>() {
    }.getType(), params);
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Kreuzelliste> getKreuzellisten(int lvkey) throws ApiClientException, ApiServerException {
    return get(String.format(URL_API_LV_KREUZELLISTEN, lvkey), false, new TypeToken<List<Kreuzelliste>>() {
    }.getType());//from  w  w w . ja  va  2 s .  c  om
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Student> getTeilnehmer(int lvkey) throws ApiClientException, ApiServerException {
    return get(String.format(URL_API_LV_TEILNEHMER, lvkey), new TypeToken<List<Student>>() {
    }.getType());// w w w.  j a  v a 2  s .  co  m
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Pruefung> getPruefungen(String semester) throws ApiClientException, ApiServerException {
    NameValuePair[] params = null;
    if (semester != null) {
        params = new BasicNameValuePair[] { new BasicNameValuePair("semester", semester) };
    }/*  w w w.  j  a va2  s .c o  m*/
    return get(URL_API_PRUEFUNGEN, new TypeToken<List<Pruefung>>() {
    }.getType(), params);
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Note> getNoten() throws ApiClientException, ApiServerException {
    return get(URL_API_NOTEN, new TypeToken<List<Note>>() {
    }.getType());//from   ww w . j a v a 2s  .  c  o m
}

From source file:at.ac.uniklu.mobile.sportal.api.UnikluSportalApiClient.java

License:Open Source License

public List<Notification> getNotifications(Date von) throws ApiClientException, ApiServerException {
    return get(URL_API_NOTIFICATIONS, false, new TypeToken<List<Notification>>() {
    }.getType(), new BasicNameValuePair("von", von.getTime() + ""));
}

From source file:at.orz.arangodb.impl.InternalEndpointDriverImpl.java

License:Apache License

public List<Endpoint> getEndpoints() throws ArangoException {

    Type type = new TypeToken<List<Endpoint>>() {
    }.getType();/*  w w  w.j a  v a  2  s .  co  m*/
    HttpResponseEntity res = httpManager.doGet(createEndpointUrl(baseUrl, null, "/_api/endpoint"));

    // because it is not include common-attribute.
    return EntityFactory.createEntity(res.getText(), type);

}