2012-08-03 17 views
6

我开始使用ColdFusion 9中添加的新cfproperty东西,但我想要使用的主要部分现在在ColdFusion 10中似乎不起作用。我创建了以下CFC:未为我创建的隐式获取者和设置器

component displayName="Sources" { 
    /** 
    * @getter true 
    * @setter true 
    * @type numeric 
    * @default 1 
    **/ 
    property sourceid; 
    /** 
    * @getter true 
    * @setter true 
    * @type numeric 
    * @default 1 
    **/ 
    property sourcegroup; 

    public any function init() { 
    This.domainRegex = '\/\/(www\.)?(([A-Za-z0-9\-_]+\.?)+)'; 
    return this; 
    } 
} 

当我甩了CFC我可以看到属性的元数据,但没有为他们创造的方法和我不能叫getSourceId()getSourceGroup()

回答

10

试试这个:

component accessors="true" displayName="Sources" { 
    property name="sourceid" type="numeric" default="1"; 
    property name="sourcegroup" type="numeric" default="1"; 
    public any function init() { 
     this.domainRegex = '\/\/(www\.)?(([A-Za-z0-9\-_]+\.?)+)'; 
     return this; 
    } 
} 
+1

IT是访问者的财产。 – 2012-08-03 12:56:35

0

尝试删除结尾评论中的第二颗星,CF例子都只有一个。

或者使用其他的语法:

property name="sourceid" type="numeric" default="1"; 

我不是注释在任何其他JavaDoc注释风扇,它只是感觉不对莫名其妙。