@@ -319,4 +319,37 @@ class AntlrParserSpec: StringSpec({
319319 mapping.targetTypePrimitive.shouldBeTrue()
320320 mapping.targetTypePrimitiveArray.shouldBeFalse()
321321 }
322+
323+ " annotate source type with fully qualified java annotation and nested type parameter" {
324+ val source = """ integer:year @ com.fasterxml.jackson.annotation.JsonFormat(shape = JsonFormat.Shape.NUMBER, pattern = "yyyy")"""
325+
326+ val mapping = parseMapping(source)
327+ mapping.kind shouldBe Mapping .Kind .ANNOTATE
328+ mapping.sourceType shouldBe " integer"
329+ mapping.sourceFormat shouldBe " year"
330+ mapping.targetType.shouldBeNull()
331+ mapping.targetGenericTypes.shouldBeEmpty()
332+ mapping.annotationType shouldBe " com.fasterxml.jackson.annotation.JsonFormat"
333+ val shape = mapping.annotationParameters[" shape" ]!!
334+ shape.value shouldBe " JsonFormat.Shape.NUMBER"
335+ shape.import.shouldBeNull()
336+ mapping.annotationParameters[" pattern" ]!!.value shouldBe """ "yyyy""""
337+ }
338+
339+ " annotate source type with fully qualified java annotation and qualified type parameter" {
340+ val source = """ integer:year @ com.fasterxml.jackson.annotation.JsonFormat(shape = com.fasterxml.jackson.annotation.JsonFormat.Shape.NUMBER, pattern = "yyyy")"""
341+
342+ val mapping = parseMapping(source)
343+ mapping.kind shouldBe Mapping .Kind .ANNOTATE
344+ mapping.sourceType shouldBe " integer"
345+ mapping.sourceFormat shouldBe " year"
346+ mapping.targetType.shouldBeNull()
347+ mapping.targetGenericTypes.shouldBeEmpty()
348+ mapping.annotationType shouldBe " com.fasterxml.jackson.annotation.JsonFormat"
349+ val shape = mapping.annotationParameters[" shape" ]!!
350+ shape.value shouldBe " JsonFormat.Shape.NUMBER"
351+ shape.import shouldBe " com.fasterxml.jackson.annotation.JsonFormat"
352+ mapping.annotationParameters[" pattern" ]!!.value shouldBe """ "yyyy""""
353+ }
354+
322355})
0 commit comments