开发者

How to define private getter method in Groovy Bean?

开发者 https://www.devze.com 2023-01-18 04:57 出处:网络
I used follow开发者_运维问答ing code. class Bike{ def manufacturer; private getManufacturer(){ manufacturer

I used follow开发者_运维问答ing code.

class Bike{
 def manufacturer;

 private getManufacturer(){
  manufacturer
 }

}

But I was able invoke getter method from another class.


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

精彩评论

暂无评论...
验证码 换一张
取 消