|
对于最新稳定版本,请使用Spring Framework 7.0.1! |
构造 函数
你可以通过使用新增功能算子。你应该用全套
所有类型除外的合格类别名称java.lang包
(整数,浮,字符串,依此类推)。以下示例展示了如何使用新增功能用来调用构造子的算符:
-
Java
-
Kotlin
Inventor einstein = parser.parseExpression(
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
.getValue(Inventor.class);
// create new Inventor instance within the add() method of List
parser.parseExpression(
"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
.getValue(societyContext);
val einstein = parser.parseExpression(
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
.getValue(Inventor::class.java)
// create new Inventor instance within the add() method of List
parser.parseExpression(
"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
.getValue(societyContext)