Closed alexander-yevsyukov closed 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?
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.
This PR migrates generation of
Query
andQueryBuilder
classes for entity states to be parts ofEntityPlugin
, which is a ProtoData plugin. Previously, code generation for queries and their builders was implemented as a part of McJavaprotoc
plugin.New code generation uses simple class references for the types in the same package with the current entity state class. Compare:
Previous version
After this PR
Changes in details
QuerySupportRenderer
class was added toEntityPlugin
. The class is responsible for generating classesQueryBuilder
andQueryBuilder
. The class also renders thequery()
method, which returnsQueryBuilder
.mc-java-entity-tests
module was introduced covering code previously tested only in integration tests. Generation ofQuery
andQueryBuilder
classes is now also functionally-tested in this module.PluginTestSetup
test fixture was introduced inmc-java-base
module.Other notable changes
FieldClassFactory
was renamed toFieldClass
.ColumnClassFactory
was renamed toColumnClass
.VersionHolder
utility object was introduced for lazily loading the version of McJava from the JAR manifest.GeneratedAnnotation
utility object was introduced.EntityPlugin
because we need them in the functional tests in themc-java-entity-tests
module.runPipelineWithDefaultSettings()
was renamed torunWithDefaultSettings()
.