如何在CFscript中指定参数属性? (CF9) [英] How to specify argument attributes in CFscript? (CF9)

查看:142
本文介绍了如何在CFscript中指定参数属性? (CF9)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CF9文件中:在CFScript中定义组件和函数,它说:

In CF9 doc: Defining components and functions in CFScript, it says:

/** 
*Comment text, treated as a hint. 
*Set metadata, including, optionally, attributes, in the last entries 
*in the comment block, as follows: 
*@metadataName metadataValue 
... 
*/ 
access returnType function functionName(arg1Type arg1Name="defaultValue1" 
arg1Attribute="attributeValue...,arg2Type 
arg2Name="defaultValue2" arg2Attribute="attributeValue...,...) 
functionAttributeName="attributeValue" ... { 
body contents 
}


$ b b

如何指定 arg1Attribute ?我试过这个:

public void function setFirstname(string firstname="" displayName="first name"){}

但不起作用。

<cffunction name="setPerson">
  <cfargument name="person" type="com.Person"/>
</cffunction>

我试过:

function setPerson(com.Person person){}

或者。 在CF9 Update 1中修复的

and it does NOT work either. "You cannot use a variable reference with "." operators in this context" it says.

推荐答案

/ p>

fixed in CF9 Update 1

/** This is setPerson function hint
*  @person this is person argument hint
*/
function setPerson(com.Person person){}

这将工作,但CFBuilder的1.0版本)将仍然认为此无效。

This will work, but CFBuilder (as of 1.0 release) will consider this invalid still.

这篇关于如何在CFscript中指定参数属性? (CF9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆