Skip to content

Commit

Permalink
rename Profile.extraMetadata -> extraArchiveMetdata [#795]
Browse files Browse the repository at this point in the history
* simpler implementation of mergeMaps
  • Loading branch information
bdon committed Jan 16, 2024
1 parent 88c0746 commit 021134c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ default boolean isOverlay() {
return false;
}

default Map<String,String> extraMetadata() { return Map.of(); }
default Map<String,String> extraArchiveMetadata() { return Map.of(); }

/**
* Defines whether {@link Wikidata} should fetch wikidata translations for the input element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;

Check warning on line 21 in planetiler-core/src/main/java/com/onthegomap/planetiler/archive/TileArchiveMetadata.java

View workflow job for this annotation

GitHub Actions / Analyze with Sonar

MINOR CODE_SMELL

Remove this unused import 'java.util.stream.Collectors'. rule: java:S1128 (https://sonarcloud.io/organizations/onthegomap/rules?open=java%3AS1128&rule_key=java%3AS1128) issue url: https://sonarcloud.io/project/issues?pullRequest=795&open=AY0SfbUj2paSppHzv-dR&id=onthegomap_planetiler
import java.util.stream.Stream;

Check warning on line 22 in planetiler-core/src/main/java/com/onthegomap/planetiler/archive/TileArchiveMetadata.java

View workflow job for this annotation

GitHub Actions / Analyze with Sonar

MINOR CODE_SMELL

Remove this unused import 'java.util.stream.Stream'. rule: java:S1128 (https://sonarcloud.io/organizations/onthegomap/rules?open=java%3AS1128&rule_key=java%3AS1128) issue url: https://sonarcloud.io/project/issues?pullRequest=795&open=AY0SfbUj2paSppHzv-dS&id=onthegomap_planetiler
import org.locationtech.jts.geom.Coordinate;
Expand Down Expand Up @@ -95,7 +96,7 @@ public TileArchiveMetadata(Profile profile, PlanetilerConfig config, List<LayerA
config.minzoom(),
config.maxzoom(),
vectorLayers == null ? null : new TileArchiveMetadataJson(vectorLayers),
mergeMaps(mapWithBuildInfo(),profile.extraMetadata()),
mergeMaps(mapWithBuildInfo(),profile.extraArchiveMetadata()),
config.tileCompression()
);
}
Expand Down Expand Up @@ -178,11 +179,9 @@ public TileArchiveMetadata withJson(TileArchiveMetadataJson json) {
*/

private static Map<String,String> mergeMaps(Map<String,String> m1, Map<String,String> m2) {
return Stream.concat(m1.entrySet().stream(), m2.entrySet().stream())
.collect(Collectors.toMap(
Map.Entry::getKey,
Map.Entry::getValue,
(value1, value2) -> value2));
var result = new TreeMap<>(m1);
result.putAll(m2);
return result;
}

@JsonAnySetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public String name() {
}

@Override
public Map<String,String> extraMetadata() {
public Map<String,String> extraArchiveMetadata() {
return Map.of("FooVersion","2.0");
}
}
Expand Down

0 comments on commit 021134c

Please sign in to comment.