Exemple #1
0
  public static String[] getFormattedAndIndexValuesAsString(
      Feature feat, LinkedHashMap<String, Boolean> fieldList, String stringFormat) {

    String[] s = new String[2];

    if (feat == null || fieldList == null || stringFormat == null || fieldList.size() == 0) {
      return s;
    }

    Object[] values = new Object[fieldList.size()];
    List<String> indexValues = new ArrayList<>();
    int i = 0;
    for (Map.Entry<String, Boolean> field : fieldList.entrySet()) {
      if (field.getValue() == false) {
        values[i] = "![missing field: " + field.getKey() + "]";
      } else {
        values[i] = feat.GetFieldAsString(field.getKey());
        indexValues.add(feat.GetFieldAsString(field.getKey()));
      }
      i++;
    }
    s[0] = String.format(stringFormat, values);
    s[1] = StringUtils.join(indexValues, " ");
    return s;
  }
Exemple #2
0
 public static String getFieldValuesAsString(
     Feature feat, LinkedHashMap<String, Boolean> fieldList) {
   List<String> s = new ArrayList<>();
   for (Map.Entry<String, Boolean> field : fieldList.entrySet()) {
     if (field.getValue() != false) {
       s.add(feat.GetFieldAsString(field.getKey()));
     }
   }
   return StringUtils.join(s, " ");
 }
Exemple #3
0
 public static LinkedHashMap getAsMapObject(
     Feature feat, LinkedHashMap<String, Boolean> fieldList) {
   LinkedHashMap<String, Object> m = new LinkedHashMap<>();
   for (Map.Entry<String, Boolean> field : fieldList.entrySet()) {
     if (field.getValue() == true) {
       m.put(field.getKey(), feat.GetFieldAsString(field.getKey()));
     }
   }
   return m;
 }