Back to project page WineDB.
The source code is released under:
MIT License
If you think the Android project WineDB listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.selesse.android.winedb.winescraper.impl; //from w w w . ja v a2s . c om import android.util.Log; import com.google.common.collect.Lists; import com.selesse.android.winedb.database.Wine; import com.selesse.android.winedb.winescraper.AbstractWineResponse; import com.selesse.android.winedb.winescraper.WineResponse; import java.util.List; @SuppressWarnings("UnusedDeclaration") public class Semantics3Response extends AbstractWineResponse implements WineResponse { private static final String TAG = Semantics3Response.class.getSimpleName(); private String code; private int total_results_count; private int offset; private int results_count; @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") private List<SemanticsResult> results; public class SemanticsResult { public SemanticsResult() {} private String name; private String price; } @Override protected List<Wine> convertResponsesToWineList() { List<Wine> wines = Lists.newArrayList(); if (results_count > 0) { for (SemanticsResult result : results) { Wine wine = new Wine(); wine.setName(result.name); if (!result.price.equals("0.00")) { wine.setPrice(result.price); } wines.add(wine); } } else { if (code.equals("OK")) { Log.i(TAG, "Returned 0 results for search query"); } else { Log.i(TAG, "Error reading JSON response"); } } return wines; } @Override public int getResultsSize() { return results_count; } }