Sha256: b4d6393d3bb20dbd732a53f3a8da93fbd20b11a4ea6733491037b91dd7e93090

Contents?: true

Size: 951 Bytes

Versions: 16

Compression:

Stored size: 951 Bytes

Contents

package sh.calaba.instrumentationbackend.query;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import sh.calaba.org.codehaus.jackson.map.ObjectMapper;

public class QueryResult {

    private List result;

    public QueryResult(List result) {

        this.result = result;
    }

    public boolean isEmpty() {
        return result.isEmpty();
    }

    public String asJson() {
        ObjectMapper mapper = new ObjectMapper();

        try {
            return mapper.writeValueAsString(result);
        } catch (IOException e) {
            throw new RuntimeException("Could not convert result to json", e);
        }
    }

    public List getResult() {
        return result;
    }


    public List asList() {
        List<Object> finalResult = new ArrayList(result.size());
        for (Object o : result) {
            finalResult.add(ViewMapper.mapView(o));
        }
        return finalResult;
    }

}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
calabash-android-0.4.20.1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.5.2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.5.2.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.5.1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.5.0 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.5.0.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.5.0.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.22.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.22.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.22.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.21 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.20 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.19 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.19.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.19.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
calabash-android-0.4.19.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java