AOT contribution for @PersistenceContext and @PersistenceUnit
Closes gh-28364
This commit is contained in:
@@ -44,6 +44,16 @@ public final class MultiStatement {
|
||||
return this.statements.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the statements defined in the specified multi statement to this instance.
|
||||
* @param multiStatement the statements to add
|
||||
* @return {@code this}, to facilitate method chaining
|
||||
*/
|
||||
public MultiStatement add(MultiStatement multiStatement) {
|
||||
this.statements.addAll(multiStatement.statements);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the specified {@link CodeBlock codeblock} rendered as-is.
|
||||
* @param codeBlock the code block to add
|
||||
|
||||
@@ -150,4 +150,17 @@ class MultiStatementTests {
|
||||
"}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void addWithAnotherMultiStatement() {
|
||||
MultiStatement statements = new MultiStatement();
|
||||
statements.addStatement(CodeBlock.of("test.invoke()"));
|
||||
MultiStatement another = new MultiStatement();
|
||||
another.addStatement(CodeBlock.of("test.another()"));
|
||||
statements.add(another);
|
||||
assertThat(statements.toCodeBlock().toString()).isEqualTo("""
|
||||
test.invoke();
|
||||
test.another();
|
||||
""");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user