Example usage for com.google.gson GsonBuilder registerTypeAdapter

List of usage examples for com.google.gson GsonBuilder registerTypeAdapter

Introduction

In this page you can find the example usage for com.google.gson GsonBuilder registerTypeAdapter.

Prototype

@SuppressWarnings({ "unchecked", "rawtypes" })
public GsonBuilder registerTypeAdapter(Type type, Object typeAdapter) 

Source Link

Document

Configures Gson for custom serialization or deserialization.

Usage

From source file:com.ccc.crest.core.cache.crest.schema.option.CrestOptions.java

License:Open Source License

public static Future<EveData> getFuture(String url, boolean doGet, CrestResponseCallback callback)
        throws Exception {
    if (url == null)
        url = getUrl();//from   w  ww  . j  a  v a  2 s  .  com
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(CrestOptions.class, new CrestOptions(doGet));
    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, url, gson.create(), null, CrestOptions.class, callback,
            ReadScope, getVersion(VersionType.Get), continueRefresh, true);
    //@formatter:on
    if (doGet)
        return CrestController.getCrestController().crestClient.getCrest(rdata);
    return CrestController.getCrestController().crestClient.getOptions(rdata);
}

From source file:com.ccc.crest.core.cache.crest.sovereignty.SovCampaignsCollection.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(SovCampaignsCollection.class, new SovCampaignsCollection());
    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            SovCampaignsCollection.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh);
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.sovereignty.SovStructureCollection.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(SovStructureCollection.class, new SovStructureCollection());
    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            SovStructureCollection.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh);
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentBanCollection.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentBanCollection.class, new TournamentBanCollection());

    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            TournamentBanCollection.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh,
            false);/* w w w . ja va 2  s. c om*/
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentCollection.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentCollection.class, new TournamentCollection());

    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            TournamentCollection.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh,
            false);/*  www.jav  a2s.  c  o  m*/
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentMatchCollection.java

License:Open Source License

public static Future<EveData> getFuture(long tournamentId, CrestResponseCallback callback) throws Exception {
    String url = getUrl();/*from ww w  .  j av a  2  s  .  co  m*/
    url += tournamentId + "/matches/";
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentMatchCollection.class, new TournamentMatchCollection());
    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, url, gson.create(), null,
            TournamentMatchCollection.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh,
            false);
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentMatchElement.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentMatchElement.class, new TournamentMatchElement());

    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            TournamentMatchElement.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh,
            false);//from w w w.j a  v  a  2 s.  c o m
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentMatchFrame.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentMatchFrame.class, new TournamentMatchFrame());

    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            TournamentMatchFrame.class, callback, ReadScope, getVersion(VersionType.Get), continueRefresh,
            false);//from  w w  w  . j a  va 2s  .c om
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentPilotStatusCollection.java

License:Open Source License

public static Future<EveData> getFuture(CrestResponseCallback callback) throws Exception {
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentPilotStatusCollection.class, new TournamentPilotStatusCollection());

    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, getUrl(), gson.create(), null,
            TournamentPilotStatusCollection.class, callback, ReadScope, getVersion(VersionType.Get),
            continueRefresh, false);/*from   ww  w  .  j  av  a  2  s .com*/
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}

From source file:com.ccc.crest.core.cache.crest.tournament.TournamentSeries.java

License:Open Source License

public static Future<EveData> getFuture(long tournamentId, CrestResponseCallback callback) throws Exception {
    String url = getUrl();/*from w  ww  .  ja v a 2s .  c  om*/
    url += tournamentId + "/series/";
    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapter(TournamentSeries.class, new TournamentSeries());
    //@formatter:off
    CrestRequestData rdata = new CrestRequestData(null, url, gson.create(), null, TournamentSeries.class,
            callback, ReadScope, getVersion(VersionType.Get), continueRefresh, false);
    //@formatter:on
    return CrestController.getCrestController().crestClient.getCrest(rdata);
}