Skip to content

Commit

Permalink
Allow supplying EntityToPureConverter to PureModelBuilder (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-m-knight-gs authored Jan 26, 2024
1 parent 484f50b commit 07db1e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement;
import org.finos.legend.engine.shared.core.deployment.DeploymentMode;
import org.finos.legend.sdlc.domain.model.entity.Entity;
import org.finos.legend.sdlc.protocol.pure.v1.EntityToPureConverter;
import org.finos.legend.sdlc.protocol.pure.v1.PureModelContextDataBuilder;

import java.util.ServiceLoader;
import java.util.stream.Stream;

public class PureModelBuilder
{
private final PureModelContextDataBuilder contextDataBuilder = PureModelContextDataBuilder.newBuilder();
private final PureModelContextDataBuilder contextDataBuilder;
private ClassLoader classLoader;
private CompilerExtensions extensions;
private String packagePrefix;

private PureModelBuilder()
private PureModelBuilder(EntityToPureConverter converter)
{
this.contextDataBuilder = PureModelContextDataBuilder.newBuilder(converter);
}

public int getElementCount()
Expand Down Expand Up @@ -230,7 +232,12 @@ private CompilerExtensions getExtensions()

public static PureModelBuilder newBuilder()
{
return new PureModelBuilder();
return newBuilder(null);
}

public static PureModelBuilder newBuilder(EntityToPureConverter converter)
{
return new PureModelBuilder(converter);
}

public static class PureModelWithContextData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class PureModelContextDataBuilder

private PureModelContextDataBuilder(EntityToPureConverter converter)
{
this.converter = converter;
this.converter = (converter == null) ? new EntityToPureConverter() : converter;
}

public int getElementCount()
Expand Down Expand Up @@ -192,7 +192,7 @@ public PureModelContextData build()

public static PureModelContextDataBuilder newBuilder()
{
return newBuilder(new EntityToPureConverter());
return newBuilder(null);
}

public static PureModelContextDataBuilder newBuilder(EntityToPureConverter converter)
Expand Down

0 comments on commit 07db1e4

Please sign in to comment.