SpineEventEngine / mc-java

Model Compiler for Java
Apache License 2.0
0 stars 2 forks source link

Migrate query generation to ProtoData plugin #141

Closed alexander-yevsyukov closed 5 months ago

alexander-yevsyukov commented 5 months ago

This PR migrates generation of Query and QueryBuilder classes for entity states to be parts of EntityPlugin, which is a ProtoData plugin. Previously, code generation for queries and their builders was implemented as a part of McJava protoc plugin.

New code generation uses simple class references for the types in the same package with the current entity state class. Compare:

Previous version

  @javax.annotation.Generated("by Spine Model Compiler")
  public static final class QueryBuilder extends io.spine.query.EntityQueryBuilder<io.spine.tools.column.ProjectId, io.spine.tools.column.Project, QueryBuilder, Query> {

After this PR

    @javax.annotation.Generated("by Spine Model Compiler (version: 2.0.0-SNAPSHOT.208)")
    public static final class QueryBuilder extends io.spine.query.EntityQueryBuilder<ProjectId, Project, QueryBuilder, Query> {

Changes in details

Other notable changes

armiol commented 5 months ago

@alexander-yevsyukov I also have a question regarding the PR description.

Here is an excerpt:


After this PR

    @javax.annotation.Generated("by Spine Model Compiler (version: 2.0.0-SNAPSHOT.208)")
    public static final class QueryBuilder extends io.spine.query.EntityQueryBuilder<ProjectId, Project, QueryBuilder, Query> {

Why io.spine.query.EntityQueryBuilder part is an FQN? Doesn't the PSI magic import it for us?

alexander-yevsyukov commented 5 months ago

Why io.spine.query.EntityQueryBuilder part is an FQN? Doesn't the PSI magic import it for us?

Unfortunately, it does not because our PSI setup does not include adding the whole classpath.