How to define private getter method in Groovy Bean?

后端 未结 1 763
小鲜肉
小鲜肉 2020-12-21 04:03

I used following code.

class Bike{
 def manufacturer;

 private getManufacturer(){
  manufacturer
 }

}

But I was able invoke getter method

相关标签:
1条回答
  • 2020-12-21 04:15

    You can't using the private modifier. This is scheduled for Groovy 2.0 I believe

    Related questions:

    • groovy call private method in Java super class
    • Groovy Parent/Child Private Field Access Weirdness With Closure
    0 讨论(0)
提交回复
热议问题