Data type support for Expression / MultiExpression (#190)

This commit is contained in:
Brian Sperlongano
2022-04-28 07:08:00 -04:00
committed by GitHub
parent 3500ee0240
commit b790ad8cd6
3 changed files with 14 additions and 7 deletions

View File

@@ -431,7 +431,7 @@ public class Generate {
/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING = %s;
""".formatted(
mappingExpression
mappingExpression.generateJavaCode()
);
String tableName = "osm_" + key;
String className = lowerUnderscoreToUpperCamel(tableName);
@@ -652,7 +652,7 @@ public class Generate {
/** Returns java code that will recreate an {@link MultiExpression} identical to {@code mapping}. */
private static String generateJavaCode(MultiExpression<String> mapping) {
return "MultiExpression.of(List.of(" + mapping.expressions().stream()
.map(s -> "MultiExpression.entry(%s, %s)".formatted(Format.quote(s.result()), s.expression()))
.map(s -> "MultiExpression.entry(%s, %s)".formatted(Format.quote(s.result()), s.expression().generateJavaCode()))
.collect(joining(", ")) + "))";
}