Skip to content

Commit

Permalink
Remove static defaultValue (metafacture-core#415)
Browse files Browse the repository at this point in the history
This was overriding every defaultValue, but maps should have the possibility
to have different default values.
  • Loading branch information
dr0i committed Dec 13, 2022
1 parent 234ab5a commit c3418a4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions metafix/src/main/java/org/metafacture/metafix/FixMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public void apply(final Metafix metafix, final Record record, final List<String>
public void apply(final Metafix metafix, final Record record, final List<String> params, final Map<String, String> options) {
final Map<String, String> map = getMap(metafix, record, params, options, KIND_OF_RDFMAP);
record.transform(params.get(0), oldValue -> {
final String newValue = map.getOrDefault(oldValue, defaultValue);
final String newValue = map.getOrDefault(oldValue, map.get(Maps.DEFAULT_MAP_KEY));
return newValue != null ? newValue : getBoolean(options, "delete") ? null : oldValue;
});
}
Expand Down Expand Up @@ -673,7 +673,6 @@ public void apply(final Metafix metafix, final Record record, final List<String>
private static final String ERROR_STRING_OPTION = "error_string";

private static final Random RANDOM = new Random();
private static String defaultValue;

private static Map<String, String> getMap(final Metafix metafix, final Record record, final List<String> params, final Map<String, String> options, final String kindOfMap) {
final Map<String, String> map;
Expand Down Expand Up @@ -703,7 +702,6 @@ private static Map<String, String> getMap(final Metafix metafix, final Record re
}
map = metafix.getMap(mapName);
}
defaultValue = map.get(Maps.DEFAULT_MAP_KEY); // TODO: Catmandu uses 'default'
return map;
}

Expand Down

0 comments on commit c3418a4

Please sign in to comment.