4.3.9 생성자 by ys
new
연산자 를 사용하여 생성자를 호출 할 수 있습니다 . 원시 형 ( int
,, float
등등)과 String 을 제외한 모든 클래스에 대해 정규화 된 클래스 이름을 사용해야합니다 . 다음 예제에서는 new
연산자를 사용하여 생성자를 호출 하는 방법을 보여줍니다 .
Inventor einstein = p.parseExpression(
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
.getValue(Inventor.class);
//create new inventor instance within add method of List
p.parseExpression(
"Members.add(new org.spring.samples.spel.inventor.Inventor(
'Albert Einstein', 'German'))").getValue(societyContext);
Last updated
Was this helpful?