コード例 #1
0
ファイル: Map.java プロジェクト: uchennafokoye/myWindyTrain
  // PARSE JSON
  private void parseJSON(JSONObject closest_station) {

    try {

      to_latitude = closest_station.getDouble("latitude");
      to_longitude = closest_station.getDouble("longitude");
      station_name = closest_station.getString("name");
      JSONArray listOfTrains = closest_station.getJSONArray("trains");
      trainsAtStation = "Trains At Station: " + listOfTrains.join(",");
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
ファイル: OracleTrait.java プロジェクト: ifhaveif/BaseDAO
 @Override
 public String genInsertSQL(String table, JSONArray jaFields) {
   String[] vh = new String[jaFields.length()];
   Arrays.fill(vh, "?");
   try {
     return new StringBuffer("INSER INTO \"")
         .append(table.toUpperCase())
         .append("\" (\"")
         .append(jaFields.join("\", \""))
         .append("\") VALUES (")
         .append(StringUtils.join(vh, ", "))
         .append(")")
         .toString();
   } catch (JSONException e) {
     throw new RuntimeException(e);
   }
 }