File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
java/src/main/kotlin/io/spine/validation/java Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public class JavaValidationRenderer : JavaRenderer() {
49
49
}
50
50
51
51
val generators = listOf (
52
- RequiredGenerator (querying = this , typeSystem)
52
+ RequiredOption (querying = this , typeSystem)
53
53
)
54
54
55
55
select(CompilationMessage ::class .java).all()
Original file line number Diff line number Diff line change @@ -197,21 +197,23 @@ internal class MessageValidationCode(
197
197
addLast(psiMethod)
198
198
}
199
199
200
- private fun validateMethodBody (rules : List <CodeBlock >, generated : List <LocalCodeBlock >): String {
200
+ private fun validateMethodBody (
201
+ rules : List <CodeBlock >,
202
+ generated : List <LocalCodeBlock >
203
+ ): String {
201
204
if (rules.isEmpty() && generated.isEmpty()) {
202
205
return """
203
206
|// This message does not have any validation constraints.
204
207
|return java.util.Optional.empty();
205
208
""" .trimMargin()
206
209
}
207
-
208
210
return """
209
211
|var $violations = new java.util.ArrayList<io.spine.validate.ConstraintViolation>();
210
212
|
211
213
|/* Rule-based constraints. */
212
214
|${rules.formatRules()}
213
215
|
214
- |/* Standalone constraints. */
216
+ |/* Standalone generated constraints. */
215
217
|${generated.formatGenerated()}
216
218
|
217
219
|if (!$violations .isEmpty()) {
Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ import io.spine.protodata.java.call
42
42
import io.spine.protodata.java.field
43
43
import io.spine.protodata.java.mapExpression
44
44
import io.spine.protodata.java.newBuilder
45
- import io.spine.protodata.java.packToAny
46
45
import io.spine.protodata.type.TypeSystem
47
46
import io.spine.server.query.Querying
48
47
import io.spine.server.query.select
@@ -58,7 +57,7 @@ import io.spine.validation.java.ErrorPlaceholder.PARENT_TYPE
58
57
import io.spine.validation.java.protodata.CodeBlock
59
58
import io.spine.validation.protodata.toBuilder
60
59
61
- internal class RequiredGenerator (
60
+ internal class RequiredOption (
62
61
private val querying : Querying ,
63
62
typeSystem : TypeSystem
64
63
) : MessageStateValidation {
You can’t perform that action at this time.
0 commit comments