You can pass objects to CFC methods, but you can't specify the java datatype in the cfargument tag. You have to do that manually.

Other than that it works just fine:

<cffunction name="testArgs">
<cfargument name="someList" type="any" required="true" />
<cfif compare(arguments.someList.getClass().getName(),"java.util.ArrayList") NEQ 0>
<cfthrow type="InvalidArgumentTypeException" message="The someList argument must be of type java.util.ArrayList" />
</cfif>
<cfoutput>An ArrayList with #arguments.someList.size()# element(s) was passed to the testArgs function.</cfoutput>
</cffunction>


<cfset myvar = createObject("java","java.util.ArrayList").init() />
<cfset myVar.add("Foo") />
<cfset testArgs(myVar) />

Spike

Joe Rinehart wrote:

Cliff,

You should be able to pass a Java object to a DAO-style CFC, and use
its properties/accessors as you would a bean (etc.) CFC - I think?

-Joe

On 5/13/05, Cliff Meyers <[EMAIL PROTECTED]> wrote:

I really don't agree that CFers should just write Java for models. One
of the big benefits of CF is the speed of development - far faster
than doing it in Java because it's a higher level language.

I agree with that too. It's frustrating because Java's OO is so powerful and flexible that it leads to designing really solid, elegant solutions... but the minute I need to start touching my database, I don't want to mess around with JDBC, I'd *much* rather use CFQUERY. Unfortunately I don't have a clue of how you might write your "business objects" in Java but still use CFC's to handle data access. Is that really even possible?


-Cliff


---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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






--

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org


---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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




Reply via email to