use of org.finos.legend.engine.language.pure.grammar.to.PureGrammarComposerUtility.convertString in project legend-engine by finos.
the class ExternalFormatGrammarComposerExtension method renderSchemaBinding.
private static String renderSchemaBinding(Binding schemaBinding) {
StringBuilder builder = new StringBuilder().append("Binding ").append(PureGrammarComposerUtility.convertPath(schemaBinding.getPath())).append("\n{\n");
if (schemaBinding.schemaSet != null) {
PureGrammarComposerUtility.appendTabString(builder).append("schemaSet: ").append(PureGrammarComposerUtility.convertPath(schemaBinding.schemaSet)).append(";\n");
if (schemaBinding.schemaId != null) {
PureGrammarComposerUtility.appendTabString(builder).append("schemaId: ").append(PureGrammarComposerUtility.convertIdentifier(schemaBinding.schemaId)).append(";\n");
}
}
PureGrammarComposerUtility.appendTabString(builder).append("contentType: ").append(PureGrammarComposerUtility.convertString(schemaBinding.contentType, true)).append(";\n");
ModelUnit modelUnit = schemaBinding.modelUnit;
PureGrammarComposerUtility.appendTabString(builder).append("modelIncludes: [\n");
builder.append(modelUnit.packageableElementIncludes.stream().map(pe -> PureGrammarComposerUtility.getTabString(2) + PureGrammarComposerUtility.convertPath(pe)).collect(Collectors.joining(",\n"))).append("\n");
PureGrammarComposerUtility.appendTabString(builder).append("];\n");
if (!modelUnit.packageableElementExcludes.isEmpty()) {
PureGrammarComposerUtility.appendTabString(builder).append("modelExcludes: [\n");
builder.append(modelUnit.packageableElementExcludes.stream().map(pe -> PureGrammarComposerUtility.getTabString(2) + PureGrammarComposerUtility.convertPath(pe)).collect(Collectors.joining(",\n"))).append("\n");
PureGrammarComposerUtility.appendTabString(builder).append("];\n");
}
return builder.append("}").toString();
}
Aggregations