code: protected PatchEntry resolveForElement(final PatchElement element) throws PatchingException {
          assert state == State.NEW;
          final PatchElementProvider provider = element.getProvider();
          final String layerName = provider.getName();
          final LayerType layerType = provider.getLayerType();
  
          final Map<String, PatchEntry> map;
          if (layerType == LayerType.Layer) {
              map = layers;
          } else {
              map = addOns;
          }
          PatchEntry entry = map.get(layerName);
          if (entry == null) {
              final InstallationManager.MutablePatchingTarget target = modification.resolve(layerName, layerType);
              if (target == null) {
                  throw PatchLogger.ROOT_LOGGER.noSuchLayer(layerName);
              }
              entry = new PatchEntry(target, element);
              map.put(layerName, entry);
          }
          // Maintain the most recent element
          entry.updateElement(element);
          return entry;
      }
docs: Get the target entry for a given patch element.
  
  @param element the patch element
  @return the patch entry
  @throws PatchingException