【发布时间】:2021-03-10 07:03:26
【问题描述】:
我想在生成的(通过 mapstruct)类中禁用 @Generate 注释。
我试试 args
-Amapstruct.suppressGeneratorTimestamp=true
和
-Amapstruct.suppressGeneratorVersionInfoComment=true,但是还是不要关闭注解。
在mapstruct的源代码中,我找到了类GeneratedType,它在构造函数中声明了一个字段generatedTypeAvailable,这会影响模板GeneratedType.ftl:
<#if !generatedTypeAvailable>/*</#if>
@Generated(
value = "org.mapstruct.ap.MappingProcessor"<#if suppressGeneratorTimestamp == false>,
date = "${.now?string("yyyy-MM-dd'T'HH:mm:ssZ")}"</#if><#if suppressGeneratorVersionComment == false>,
comments = "version: ${versionInformation.mapStructVersion}, compiler: ${versionInformation.compiler}, environment: Java ${versionInformation.runtimeVersion} (${versionInformation.runtimeVendor})"</#if>
)<#if !generatedTypeAvailable>
*/</#if>
那么,如何将字段值generatedTypeAvailable设置为false?
【问题讨论】: