docs: public static TDWay fromWay(Way way, NodeResolver resolver, List<String> preferredLanguages) {
          if (way == null)
              return null;
  
          SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(way, preferredLanguages);
          Map<Short, Object> knownWayTags = OSMUtils.extractKnownWayTags(way);
  
          // only ways with at least 2 way nodes are valid ways
          if (way.getWayNodes().size() >= 2) {
              boolean validWay = true;
              // retrieve way nodes from data store
              TDNode[] waynodes = new TDNode[way.getWayNodes().size()];
              int i = 0;
              for (WayNode waynode : way.getWayNodes()) {
                  // TODO adjust interface to support a method getWayNodes()
                  waynodes[i] = resolver.getNode(waynode.getNodeId());
                  if (waynodes[i] == null) {
                      validWay = false;
                      LOGGER.finer("unknown way node: " + waynode.getNodeId() + " in way " + way.getId());
                  }
                  i++;
              }
  
              // for a valid way all way nodes must be existent in the input data
              if (validWay) {
                  // mark the way as polygon if the first and the last way node are the same
                  // and if the way has at least 4 way nodes
                  byte shape = LINE;
                  if (waynodes[0].getId() == waynodes[waynodes.length - 1].getId()) {
                      if (waynodes.length >= GeoUtils.MIN_NODES_POLYGON) {
                          if (OSMUtils.isArea(way)) {
                              shape = SIMPLE_POLYGON;
                          }
                      } else {
                          LOGGER.finer("Found closed polygon with fewer than 4 way nodes. Way-id: " + way.getId());
                          return null;
                      }
                  }
  
                  return new TDWay(way.getId(), ster.getLayer(), ster.getName(), ster.getHousenumber(), ster.getRef(),
                          knownWayTags, shape, waynodes);
              }
          }
  
          return null;
      }