Bryan, what you're missing here is that an unrecognized type has to be a
CFC. You'd have a SpecialNumber.cfc file in your CFC directory.

specialnumber.cfc
<cfcomponent displayname="SpecialNumber">
  <cfset variables.instance = StructNew() />
  <cfset variables.instance.data = 0 />
  <cffunction name="setValue" returntype="SpecialNumber">
    <cfargument name="newNumber" type="numeric">
    <!--- validation... --->
    <cfset variables.instance.data = arguments.newNumber />
    <cfreturn this />
  </cffunction>
  <cffunction name="getValue" returntype="numeric">
    <cfreturn variables.instance.data />
  </cffunction>
</cfcomponent>

someother.cfc
<cfcomponent displayname="Some Other Component">
  <cfset variables.instance = StructNew() />
  <cfset variables.instance.someNumber = CreateObject("component",
"cfcpath.to.specialnumber") />
  <cffunction name="setSomeNumber" returntype="boolean">
    <cfargument name="newNumber" type="SpecialNumber" />
    <cfset variables.instance.someNumber = arguments.newNumber />
    <cfreturn true />
  </cffunction>
</cfcomponent>

-- 
Eric C. Davis
Programmer/Analyst I
Georgia Department of Transportation
Office of I.T. Applications
Web Applications Group
404.463.2860.199
[EMAIL PROTECTED]


-----Original Message-----
From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 10:46 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Custom argument types


I know that. Regarding item 4.

"You could also make a CFC, SpecialNumber. When you create it, you pass
in the #. The CFC handles all the silly checking."

cfc2
<cfcomponent>
        <cffunction name="specialNumber" access="public"
returntype="???">
                <cfargument name="theNumber" required="yes"
type="numeric">
                
                <cfset var specialNumberReturn=''>
                <cfscript>
                        if(arguments.theNumber gt 5)    {
                                specialNumberReturn=true;
                        } else {
                                throw('This CFC will self destruct
in...');
                        }
                </cfscript>
                
                <cfreturn ?????>
        </cffunction>
</cfcomponent>


" If another CFC wants to use a method and require that type of value,
then you would just use type="SpecialNumber" for your cfargument tag.""

cfc1
<cfcomponent>
        <cffunction name="yaddaDoodle" access="public"
returntype="boolean">
                <cfargument name="theSpecialNumber" required="yes"
type="specialNumber">
        ....
        </cffunction>
</cfcomponent>

How does CFC 1 know where to look for CFC 2?



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to