If you had the library, you could do this, but it'd be asking for
trouble, because the class might change names at some future point (or
maybe already has in CF7).

java.util.Hashtable implements java.util.Map, so therefore CF structs
also implement the interface.  Your original question was about
passing a CF struct into Java.  Since the CF struct implements the Map
interface, you can declare your parameter of type Map, and treat the
CF struct exactly as any other Map instance you might come across.

If, however, what you need to do is create a CF structure in Java and
return it to CF, you're in a bit of a bind.  You can do it, but I
wouldn't.  Rather, I'd just return a Map (your choice of
implementation) and then use it from your CF with the Map interface
(i.e. contains(), put(), get(), etc.) rather than the native CF struct
nomenclature.  That'll give you more flexibility down the road, and
since you're already programming in Java, continuing to use the Java
methods shouldn't be a hassle.  If nothing else, you can return the
Map from your Java method and then convert it into a CF struct.

As for your interface exception, you can't instantiate interfaces, you
have to instantiate a class that implements the interface. 
java.util.Hashtable and java.util.HashMap are the most common choices
(the former is synchronized, the latter isn't), and there's a
java.util.TreeMap as well in the core JRE.

cheers,
barneyb


On Tue, 8 Feb 2005 20:14:33 -0500, Troy Simpson <[EMAIL PROTECTED]> wrote:
> Hey,
> I want to add that I found this article at bpurcell.org:
> http://www.bpurcell.org/blog/index.cfm?mode=entry&entry=925
> 
> It says that a ColdFusion Structure is an Object of type
> coldfusion.runtime.Struct.  Here is the inheritance change:
> 
> java.util.Hashtable
> --coldfusion.util.FastHashtable
> ----coldfusion.runtime.Struct
> 
> Do you think I could use this data type in my Code like so?
> coldfusion.runtime.Struct wc = new coldfusion.runtime.Struct();
> 
> Where would I find the libraries?
> Would this be bad practice?
> 
> Thanks,
> Troy
> 


-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193770
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to