@Test public void testParseMyPlacesWithIds() throws Exception { String payload = getInput(PAYLOAD); boolean shouldSetId = true; List<MyPlace> myPlaces = MyPlacesFeaturesWFSTRequestBuilder.parseMyPlaces(payload, shouldSetId); assertEquals("ids should be set", 123L, myPlaces.get(0).getId()); assertEquals("ids larger than Integer.MAX work", 9876543210123456L, myPlaces.get(1).getId()); }
public static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId) throws JSONException { JSONObject featureCollection = new JSONObject(input); String srsName = JSONHelper.optString(featureCollection, "srsName"); int srid = getSrid(srsName, 0); JSONArray features = featureCollection.getJSONArray("features"); final int n = features.length(); List<MyPlace> myPlaces = new ArrayList<>(n); for (int i = 0; i < n; i++) { JSONObject feature = features.getJSONObject(i); myPlaces.add(parseMyPlace(feature, shouldSetId, srid)); } return myPlaces; }
MyPlacesFeaturesWFSTRequestBuilder extends WFSTRequestBuilder { public static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId) throws JSONException { JSONObject featureCollection = new JSONObject(input); String srsName = JSONHelper.optString(featureCollection, "srsName"); int srid = getSrid(srsName, 0); JSONArray features = featureCollection.getJSONArray("features"); final int n = features.length(); List<MyPlace> myPlaces = new ArrayList<>(n); for (int i = 0; i < n; i++) { JSONObject feature = features.getJSONObject(i); myPlaces.add(parseMyPlace(feature, shouldSetId, srid)); } return myPlaces; } }
MyPlacesFeaturesWFSTRequestBuilder extends WFSTRequestBuilder { public static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId) throws JSONException { JSONObject featureCollection = new JSONObject(input); String srsName = JSONHelper.optString(featureCollection, "srsName"); int srid = getSrid(srsName, 0); JSONArray features = featureCollection.getJSONArray("features"); final int n = features.length(); List<MyPlace> myPlaces = new ArrayList<>(n); for (int i = 0; i < n; i++) { JSONObject feature = features.getJSONObject(i); myPlaces.add(parseMyPlace(feature, shouldSetId, srid)); } return myPlaces; }  }
MyPlacesFeaturesWFSTRequestBuilder extends WFSTRequestBuilder { public static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId) throws JSONException { JSONObject featureCollection = new JSONObject(input); String srsName = JSONHelper.optString(featureCollection, "srsName"); int srid = getSrid(srsName, 0); JSONArray features = featureCollection.getJSONArray("features"); final int n = features.length(); List<MyPlace> myPlaces = new ArrayList<>(n); for (int i = 0; i < n; i++) { JSONObject feature = features.getJSONObject(i); myPlaces.add(parseMyPlace(feature, shouldSetId, srid)); } return myPlaces; }  static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId); static MyPlace parseMyPlace(JSONObject feature, boolean shouldSetId, int srid); static void getMyPlacesByCategoryId(OutputStream out, String crs,
            long categoryId); static void getMyPlacesByUserId(OutputStream out, String crs,
            String uuid); static void getMyPlacesById(OutputStream out, String crs,
            String[] ids); static void insertMyPlaces(OutputStream out, List<MyPlace> places); static void updateMyPlaces(OutputStream out, List<MyPlace> places); static void deleteMyPlaces(OutputStream out, long[] ids); static String prefixId(long id); static String[] prefixIds(long[] ids); static long removePrefixFromId(String prefixed); static long[] removePrefixFromIds(String[] prefixed); }
MyPlacesFeaturesWFSTRequestBuilder extends WFSTRequestBuilder { public static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId) throws JSONException { JSONObject featureCollection = new JSONObject(input); String srsName = JSONHelper.optString(featureCollection, "srsName"); int srid = getSrid(srsName, 0); JSONArray features = featureCollection.getJSONArray("features"); final int n = features.length(); List<MyPlace> myPlaces = new ArrayList<>(n); for (int i = 0; i < n; i++) { JSONObject feature = features.getJSONObject(i); myPlaces.add(parseMyPlace(feature, shouldSetId, srid)); } return myPlaces; }  static List<MyPlace> parseMyPlaces(String input, boolean shouldSetId); static MyPlace parseMyPlace(JSONObject feature, boolean shouldSetId, int srid); static void getMyPlacesByCategoryId(OutputStream out, String crs,
            long categoryId); static void getMyPlacesByUserId(OutputStream out, String crs,
            String uuid); static void getMyPlacesById(OutputStream out, String crs,
            String[] ids); static void insertMyPlaces(OutputStream out, List<MyPlace> places); static void updateMyPlaces(OutputStream out, List<MyPlace> places); static void deleteMyPlaces(OutputStream out, long[] ids); static String prefixId(long id); static String[] prefixIds(long[] ids); static long removePrefixFromId(String prefixed); static long[] removePrefixFromIds(String[] prefixed);  }