void (JDefinedClass jclass, List<JType> subTypes) { JAnnotationUse jsonTypeInfo = jclass.annotate(JsonTypeInfo.class); jsonTypeInfo.param("use", JsonTypeInfo.Id.DEDUCTION); JAnnotationUse jsonSubTypes = jclass.annotate(JsonSubTypes.class); JAnnotationArrayMember subTypesList = jsonSubTypes.paramArray("value"); for (JType value : subTypes) { JAnnotationUse subtype = subTypesList.annotate(JsonSubTypes.Type.class); subtype.param("value", value); } }