2012-08-03 14 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註釋風扇,它只是感覺不對莫名其妙。