This UDF might help you

http://www.cflib.org/udf.cfm?ID=1076

Qasim

On 2/8/06, Gaulin, Mark <[EMAIL PROTECTED]> wrote:
>
> Nice!  I can see this opening new windows when the value of a getter is
> another java class. (Hmm.. Maybe I'll do that...)
>
> Q: Do you know how to test if an object is a java object from cf?
> IsObject() returns false (which makes sense), but I didn't see a
> "proper" way to test for that.
>
> Thanks for the help.
>
>         Mark
>
> -----Original Message-----
> From: Rick Root [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 2:42 PM
> To: CF-Talk
> Subject: Re: Good way to dump java object?
>
> Gaulin, Mark wrote:
> > Hi
> > I'm looking for a good way to dump the public properties of a java
> > object, but it should include values available from getX() methods,
> > not just public "field" members (which I don't ever have).
> >
> > It could be a java solution or a cf custom tag (of cfc).
> >
> > If someone has a head-start on a custom tag that uses java reflection,
>
> > I'll pick that up and run with it.
>
> this was a fun little challenge.  Maybe this will help you.
>
> The following function accepts a java object as an argument, and dumps
> the value of every getXXX() method that requires no arguments.
>
> <cffunction name="dumpJavaObject">
>         <cfargument name="obj" type="any" required="yes">
>         <cfset var methodname = "">
>         <cfset var classInfo = obj.getClass()> <!--- class object --->
>         <cfset var methods = classInfo.getMethods()>
>         <cfset var I = 0>
>
>         <cfloop from="1" to="#ArrayLen(methods)#" step="1" index="I">
>                 <cfset methodName = methods[i].getName()>
>                 <cfif refind("^get",methodName) gt 0>
>                         <cfif arrayLen(methods[i].getParameterTypes())
> is 0>
>                                 <cfoutput><hr>#methodName# =
> <br></cfoutput>
>                                 <cftry>
>                                         <cfdump
> var="#evaluate("obj.#methodName#()")#">
>                                         <cfcatch type="any">
>                                         Unable to dump
> ##evaluate("obj.#methodName#()")##<br>
>                                         </cfcatch>
>                                 </cftry>
>                         </cfif>
>                 </cfif>
>         </cfloop>
> </cffunction>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231675
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to