This PR continues migration of McJava to handle code generation using ProtoData plugins. This PR adds code generation for the Field classes nested under a message type for that such a message could be queried in the API of the generated Field class.
Improvements to the code generation API
The following abstract classes were introduced:
MessageTypeRenderer class — this class is an abstract base for Java renderers that augment Protobuf generated code for a message type.
NestedUnderMessage — this is the abstract base for code generators for producing classes nested under Java classes of messages. Such code generators are not Renderers, these classes are used by Renderers because they provide "horizontal" aspects of code generation (e.g. adding a nested class, implementing an interface etc.) Renderers on the other hand implement the whole scope of code generation for a particular kind of message type such as entity state or a signal.
MessageTypeRenderer descendants
SignalRenderer — the abstract base for CommandRender, EventRenderer, RejectionRenderer.
ColumnClassRenerer — renders Column class under an EntityState message.
FieldClassRenderer — renders Field class for an EntityState message.
NestedUnderMesage descentants
ColumnClassFactory — the code generator for a Column class. ColumnClassRenderer delegates to ColumnClassFactory.
FieldClassFactory — the code generator for a Field class. FieldClassRenderer, GroupedMessageRenderer, and SignalRenderer delegate to FieldClassFactory.
Changes to the project structure
mc-java-signal and mc-java-message-group modules were introduced.
mc-java-rejection was merged into mc-java-signal.
Now the project has two test-only modules with the name suffix -tests. Please see TESTING.md in the root of the project for the description of these modules.
Other notable changes
The package io.spine.tools.mc.java.gradle.codegen was renamed to settings.
FilePattern, FilePatternFactory from ProtoData was adopted instead of FilePatters utility and PatternFactory Java classes that used to be in the codegen package and the FilePattern type from Validation.
MessageCodegenOptions class was renamed to CodegenConfig to "rhyme" with other Config classes in the same package.
MessagesConfig was renamed to MessagesGroupConfig.
SignalSettings message type was introduced replacing three separate fields under CodegenOptions options. The type is now also used for passing settings to the Signal Plugin.
The EntityPlugin moved under the io.spine.tools.mc.java.entity package. Previously it was in io.spine.tools.mc.entity. Even though the plugin has some internals that are language neutral, the code it generates is Java. So the java package nested under mc is appropriate.
Fixed the entity kind in the DiscoveredEntities. It used to be PROCESS_MANAGER now it's PROJECTION.
This PR continues migration of McJava to handle code generation using ProtoData plugins. This PR adds code generation for the
Field
classes nested under a message type for that such a message could be queried in the API of the generatedField
class.Improvements to the code generation API
The following abstract classes were introduced:
MessageTypeRenderer
class — this class is an abstract base for Java renderers that augment Protobuf generated code for a message type.NestedUnderMessage
— this is the abstract base for code generators for producing classes nested under Java classes of messages. Such code generators are notRenderer
s, these classes are used byRenderer
s because they provide "horizontal" aspects of code generation (e.g. adding a nested class, implementing an interface etc.)Renderer
s on the other hand implement the whole scope of code generation for a particular kind of message type such as entity state or a signal.MessageTypeRenderer
descendantsSignalRenderer
— the abstract base forCommandRender
,EventRenderer
,RejectionRenderer
.ColumnClassRenerer
— rendersColumn
class under anEntityState
message.FieldClassRenderer
— rendersField
class for anEntityState
message.NestedUnderMesage
descentantsColumnClassFactory
— the code generator for aColumn
class.ColumnClassRenderer
delegates toColumnClassFactory
.FieldClassFactory
— the code generator for aField
class.FieldClassRenderer
,GroupedMessageRenderer
, andSignalRenderer
delegate toFieldClassFactory
.Changes to the project structure
mc-java-signal
andmc-java-message-group
modules were introduced.mc-java-rejection
was merged intomc-java-signal
.-tests
. Please seeTESTING.md
in the root of the project for the description of these modules.Other notable changes
io.spine.tools.mc.java.gradle.codegen
was renamed tosettings
.FilePattern
,FilePatternFactory
from ProtoData was adopted instead ofFilePatters
utility andPatternFactory
Java classes that used to be in thecodegen
package and theFilePattern
type from Validation.MessageCodegenOptions
class was renamed toCodegenConfig
to "rhyme" with otherConfig
classes in the same package.MessagesConfig
was renamed toMessagesGroupConfig
.SignalSettings
message type was introduced replacing three separate fields underCodegenOptions
options. The type is now also used for passing settings to the Signal Plugin.EntityPlugin
moved under theio.spine.tools.mc.java.entity
package. Previously it was inio.spine.tools.mc.entity
. Even though the plugin has some internals that are language neutral, the code it generates is Java. So thejava
package nested undermc
is appropriate.DiscoveredEntities
. It used to bePROCESS_MANAGER
now it'sPROJECTION
.