douyue3800 2012-04-02 09:26
浏览 64
已采纳

Netbeans:改变php模块中getter / setter生成行为的可能性

Greetings programmers,

I was wondering if there is a possibility to change the behaviour of getter/setter generation in php module. At the moment it works like this:

class A
{
    private $field;
}

Now I will generate setter by pressing alt+ins and selecting "Setter..." resulting in:

class A
{
    private $field;

    public function setField($field)
    {
         $this->field = $field;
    }
}

Is there a possibility to change the behaviour that it would generate something differnet, lets say this:

class A
{
    private $field;

    public function setField($field)
    {
         $this->field = $field;
         return $this;
    }
}

The difference is at the returh $this row.

  • 写回答

1条回答 默认 最新

  • doukuiqian5345 2012-10-17 15:01
    关注

    I ran into this old question while searching for ways to adjust the template used for setter/getter generation in netbeans.

    Since this question is left unanswered, ill leave a pointer to a similar question: How to edit getter & setter templates in NetBeans?

    Basically the answer is: No, you can not change the template of the setter/getter generator in netbeans. Atleast not unless you are willing to patch the Netbeans sourcecode.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上