docs: public static SpecialTagExtractionResult extractSpecialFields(Entity entity, List<String> preferredLanguages) {
          String name = null;
          String ref = null;
          String housenumber = null;
          byte layer = 5;
          short elevation = 0;
          String relationType = null;
  
          if (entity.getTags() != null) {
              // Process 'name' tags
              if (preferredLanguages != null && preferredLanguages.size() > 1) { // Multilingual map
                  // Convert tag collection to list and sort it
                  // i.e. making sure default 'name' comes first
                  List<Tag> tags = new ArrayList<Tag>(entity.getTags());
                  Collections.sort(tags);
  
                  String defaultName = null;
                  List<String> restPreferredLanguages = new ArrayList<String>(preferredLanguages);
                  for (Tag tag : tags) {
                      String key = tag.getKey().toLowerCase(Locale.ENGLISH);
                      if ("name".equals(key)) { // Default 'name'
                          defaultName = tag.getValue();
                          name = defaultName;
                      } else { // Localized name
                          Matcher matcher = NAME_LANGUAGE_PATTERN.matcher(key);
                          if (!matcher.matches()) {
                              continue;
                          }
                          if (tag.getValue().equals(defaultName)) { // Same with default 'name'?
                              continue;
                          }
                          String language = matcher.group(3).toLowerCase(Locale.ENGLISH).replace('_', '-');
                          if (preferredLanguages.contains(language)) {
                              restPreferredLanguages.remove(language);
                              name = (name != null ? name + '\r' : "") + language + '\b' + tag.getValue();
                          }
                      }
                  }
  
                  // Check rest preferred languages for falling back to base
                  if (!restPreferredLanguages.isEmpty()) {
                      Map<String, String> fallbacks = new HashMap<String, String>();
                      for (String preferredLanguage : restPreferredLanguages) {
                          for (Tag tag : tags) {
                              String key = tag.getKey().toLowerCase(Locale.ENGLISH);
                              Matcher matcher = NAME_LANGUAGE_PATTERN.matcher(key);
                              if (!matcher.matches()) {
                                  continue;
                              }
                              if (tag.getValue().equals(defaultName)) { // Same with default 'name'?
                                  continue;
                              }
                              String language = matcher.group(3).toLowerCase(Locale.ENGLISH).replace('_', '-');
                              if (!fallbacks.containsKey(language) && !language.contains("-") && (preferredLanguage.contains("-") || preferredLanguage.contains("_"))
                                      && preferredLanguage.toLowerCase(Locale.ENGLISH).startsWith(language)) {
                                  fallbacks.put(language, tag.getValue());
                              }
                          }
                      }
                      for (String language : fallbacks.keySet()) {
                          name = (name != null ? name + '\r' : "") + language + '\b' + fallbacks.get(language);
                      }
                  }
              } else { // Non multilingual map
                  boolean foundPreferredLanguageName = false;
                  for (Tag tag : entity.getTags()) {
                      String key = tag.getKey().toLowerCase(Locale.ENGLISH);
                      if ("name".equals(key) && !foundPreferredLanguageName) {
                          name = tag.getValue();
                      } else if (preferredLanguages != null && !foundPreferredLanguageName) {
                          Matcher matcher = NAME_LANGUAGE_PATTERN.matcher(key);
                          if (matcher.matches()) {
                              String language = matcher.group(3);
                              if (language.equalsIgnoreCase(preferredLanguages.get(0))) {
                                  name = tag.getValue();
                                  foundPreferredLanguageName = true;
                              }
                          }
                      }
                  }
              }
  
              // Process rest tags
              for (Tag tag : entity.getTags()) {
                  String key = tag.getKey().toLowerCase(Locale.ENGLISH);
                  if ("piste:name".equals(key) && name == null) {
                      name = tag.getValue();
                  } else if ("addr:housenumber".equals(key)) {
                      housenumber = tag.getValue();
                  } else if ("ref".equals(key)) {
                      ref = tag.getValue();
                  } else if ("layer".equals(key)) {
                      String l = tag.getValue();
                      try {
                          byte testLayer = Byte.parseByte(l);
                          if (testLayer >= -5 && testLayer <= 5) {
                              testLayer += 5;
                          }
                          layer = testLayer;
                      } catch (NumberFormatException e) {
                          LOGGER.finest("could not parse layer information to byte type: " + tag.getValue()
                                  + "\t entity-id: " + entity.getId() + "\tentity-type: " + entity.getType().name());
                      }
                  } else if ("ele".equals(key)) {
                      Double floatElevation = parseDoubleUnit(tag.getValue());
                      if (floatElevation != null) {
                          if (floatElevation < MAX_ELEVATION) {
                              elevation = floatElevation.shortValue();
                          }
                      } else {
                          LOGGER.finest("could not parse elevation information to double type: " + tag.getValue()
                                  + "\t entity-id: " + entity.getId() + "\tentity-type: " + entity.getType().name());
                      }
                  } else if ("type".equals(key)) {
                      relationType = tag.getValue();
                  }
              }
          }
  
          return new SpecialTagExtractionResult(name, ref, housenumber, layer, elevation, relationType);
      }