Search in sources :

Example 1 with MoshiSerializer

use of com.bluelinelabs.logansquare.demo.serializetasks.MoshiSerializer in project LoganSquare by bluelinelabs.

the class MainActivity method performSerializeTests.

private void performSerializeTests() {
    mBarChart.clear();
    mBarChart.setSections(new String[] { "Serialize 60 items", "Serialize 20 items", "Serialize 7 items", "Serialize 2 items" });
    Gson gson = new Gson();
    ObjectMapper objectMapper = new ObjectMapper();
    Moshi moshi = new Moshi.Builder().build();
    List<Serializer> serializers = new ArrayList<>();
    for (Response response : mResponsesToSerialize) {
        for (int iteration = 0; iteration < ITERATIONS; iteration++) {
            serializers.add(new GsonSerializer(mSerializeListener, response, gson));
            serializers.add(new JacksonDatabindSerializer(mSerializeListener, response, objectMapper));
            serializers.add(new LoganSquareSerializer(mSerializeListener, response));
            serializers.add(new MoshiSerializer(mSerializeListener, response, moshi));
        }
    }
    for (Serializer serializer : serializers) {
        serializer.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
    }
}
Also used : JacksonDatabindSerializer(com.bluelinelabs.logansquare.demo.serializetasks.JacksonDatabindSerializer) Moshi(com.squareup.moshi.Moshi) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) GsonSerializer(com.bluelinelabs.logansquare.demo.serializetasks.GsonSerializer) MoshiSerializer(com.bluelinelabs.logansquare.demo.serializetasks.MoshiSerializer) Response(com.bluelinelabs.logansquare.demo.model.Response) LoganSquareSerializer(com.bluelinelabs.logansquare.demo.serializetasks.LoganSquareSerializer) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Serializer(com.bluelinelabs.logansquare.demo.serializetasks.Serializer) MoshiSerializer(com.bluelinelabs.logansquare.demo.serializetasks.MoshiSerializer) LoganSquareSerializer(com.bluelinelabs.logansquare.demo.serializetasks.LoganSquareSerializer) GsonSerializer(com.bluelinelabs.logansquare.demo.serializetasks.GsonSerializer) JacksonDatabindSerializer(com.bluelinelabs.logansquare.demo.serializetasks.JacksonDatabindSerializer)

Aggregations

Response (com.bluelinelabs.logansquare.demo.model.Response)1 GsonSerializer (com.bluelinelabs.logansquare.demo.serializetasks.GsonSerializer)1 JacksonDatabindSerializer (com.bluelinelabs.logansquare.demo.serializetasks.JacksonDatabindSerializer)1 LoganSquareSerializer (com.bluelinelabs.logansquare.demo.serializetasks.LoganSquareSerializer)1 MoshiSerializer (com.bluelinelabs.logansquare.demo.serializetasks.MoshiSerializer)1 Serializer (com.bluelinelabs.logansquare.demo.serializetasks.Serializer)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Gson (com.google.gson.Gson)1 Moshi (com.squareup.moshi.Moshi)1 ArrayList (java.util.ArrayList)1