Nested annotation list in Scala

reference

How do I do something like the following in Scala?

import org.hibernate.validator.constraints.ScriptAssert @ScriptAssert.List({ @ScriptAssert(script = "...", lang = "javascript"), @ScriptAssert(script = "...", lang = "javascript")}) 
+7
scala annotations hibernate-validator bean-validation
source share
1 answer

The correct syntax is as follows ( Array(...) for arrays, new Nested(..) for nested annotations):

 import org.hibernate.validator.constraints.ScriptAssert @ScriptAssert.List(Array( new ScriptAssert(script = "...", lang = "javascript"), new ScriptAssert(script = "...", lang = "javascript"))) class Test 
+7
source share

All Articles