groovy@TupleConstructor includeFields vs IncludeProperty

groovy@TupleConstructor includeFields vs IncludeProperty,groovy,transform,abstract-syntax-tree,Groovy,Transform,Abstract Syntax Tree,在groovy的注释中,includeFields和IncludeProperty之间的区别是什么。属性是否只包括公共setter/getter,字段是否包括privates?我找不到任何与此相关的文档。Groovy字段是没有getter和setter的公共属性: @groovy.transform.TupleConstructor(includeFields=false) class Invoice { Integer serie, number // properties BigD

在groovy的注释中,includeFields和IncludeProperty之间的区别是什么。属性是否只包括公共setter/getter,字段是否包括privates?我找不到任何与此相关的文档。

Groovy字段是没有getter和setter的公共属性:

@groovy.transform.TupleConstructor(includeFields=false) 
class Invoice {
  Integer serie, number // properties
  BigDecimal total // property
  public Integer type // this is a field
}


try {
  i = new Invoice(1, 2, 10.0, 10)
  assert false
} catch (e) {
  assert true
}

Groovy字段是没有getter和setter的公共属性:

@groovy.transform.TupleConstructor(includeFields=false) 
class Invoice {
  Integer serie, number // properties
  BigDecimal total // property
  public Integer type // this is a field
}


try {
  i = new Invoice(1, 2, 10.0, 10)
  assert false
} catch (e) {
  assert true
}

谢谢你的澄清。有相关文档吗?:如果使用访问修饰符public、private或protected声明[属性]的名称,则会生成一个字段。感谢您的澄清。有相关文档吗?:如果使用访问修饰符public、private或protected声明[属性的]名称,则会生成一个字段。