I've been loathed to answer this thread as it is hard to explain why you
can't really do what you want in CFMX. There is one way to do it in
CFMX, but it isn't pretty and quite tough to explain. It would really
behoove you to rethink what you are trying to do or simply do it in
Java. Nevertheless, let me explain what the problem is.

I assume you are using the keys method, which returns an Enumeration.
Since an Enumeration is just an interface, the object returned really is
a Hashtable$Enumerator, which is an inner class of Hashtable that
implements the Enumeration interface. Thus, you can't really instantiate
a Hashtable$Enumerator. One idea would be the following.

<cfscript>
        enum = CreateObject("java", "java.util.Enumeration");
        enum = yourHashtable.keys();
        foo = enum.next();
</cfscript>

If the above even works, enum.next() will return an Object, so it won't
be of much use. You would need to find a way to cast the Object into its
real type. This is where it gets ugly. The following might work.

<cfscript>
        enum = CreateObject("java", "java.util.Enumeration");
        enum = yourHashtable.keys();
        foo = enum.next();
        class = foo.getClass();
        bar = CreateObject("java", class.getName());
        foo = bar;
</cfscript>

Again, this is all real ugly and not functional. If you could tell us
what you are trying to do, possible we could find another way.

Matt Liotta
President & CEO
Montara Software, Inc.
http://www.montarasoftware.com/
888-408-0900 x901

> -----Original Message-----
> From: Marcello Frutig [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 11, 2002 3:51 PM
> To: CF-Talk
> Subject: RE: CFMX: how to deal with type
java.util.Hashtable$Enumerator
> 
> Nice thread... :-) But I'm still looking for a nice suggestion to my
> original question :-)
> 
> Is it possible to get the elements of an object of type
> java.util.Hashtable$Enumerator? When cfdumping the returned object I
can
> see the methods hasMoreElements(), next() etc. But when calling any of
> these methods, I got java.lang.IllegalAccessException.
> 
> Thanks,
> Marcello.
> 
> 
> >Outlook XP does not treat it as a single, clickable link.
> >
> >Benjamin S. Rogers
> >http://www.c4.net/
> >v.508.240.0051
> >f.508.240.0057
> >
> >-----Original Message-----
> >From: Dick Applebaum [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, September 11, 2002 11:48 AM
> >To: CF-Talk
> >Subject: Re: CFMX: how to deal with type
java.util.Hashtable$Enumerator
> >
> >
> >Yes it still wraps (i didn't say that it wouldn't wrap),  but the
email
> >client (at least most do) treats it as a single, contiguous,
> >double-clickable URL.
> >
> >Dick
> >
> >On Wednesday, September 11, 2002, at 08:21 AM, Tangorre, Michael
wrote:
> >
> >> it still wrapped in your email.
> >>
> >> -----Original Message-----
> >> From: Dick Applebaum [mailto:[EMAIL PROTECTED]]
> >> Sent: Wednesday, September 11, 2002 11:17 AM
> >> To: CF-Talk
> >> Subject: Re: CFMX: how to deal with type
> >java.util.Hashtable$Enumerator
> >>
> >>
> >> A while ago, someone posted this hint:
> >>
> >> If you send a URL in an email, you can avoid it being broken into
> >> segments by line-wrapping.  Just include the URL within < and >
> >> characters , for example:
> >> <http://java.sun.com/j2se/1.4/docs/api/java/util/>
> Enumeration.html#method_summary>.
> >>
> >> Most email clients will treat the information within < and> as on
> >> continuous double-clickable, string.
> >>
> >> Don't use parenthesis (or any other characters), as they get
included
> >> with the URL!
> >>
> >> Try it, it works-- and makes life easier for the recipients.
> >>
> >> HTH
> >>
> >> Dick
> >>
> >>
> >> On Wednesday, September 11, 2002, at 07:51 AM, Jann VanOver wrote:
> >>
> >>> Try nextElement().
> >>>
> >>> See
> >>> http://java.sun.com/j2se/1.4/docs/api/java/util/
> >>> Enumeration.html#method_summ
> >>> ary
> >>>
> >>> (That is a long URL and may need to be stuck back together before
> >>> being
> >>> used)
> >>>
> >>> On 9/10/02 9:27 AM, "Marcello Frutig" <[EMAIL PROTECTED]>
> >>> wrote:
> >>>
> >>>> Hello!
> >>>>
> >>>> I'm calling a Java method in CFMX that is returning an object of
> >type
> >>>> java.util.Hashtable$Enumerator. How could I deal with this object
in
> >>>> CFML in
> >>>> order to get the elements/values? I've tried to use the methods
> >>>> next(), etc.
> >>>> without success.
> >>>>
> >>>> Thanks,
> >>>> Marcello Frutig.
> >>>> -- Astrolabio
> >>>>
> >>>>
> >>>
> >>
> >>
> >
> >
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to