House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  Object Oriented Programming with ColdFusion

Simulating Enumerated Types in ColdFusion

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
bayo
04/16/2007 05:35 PM

Hi, all. Any ideas on how to simulate enumerated types in CF? Is it even worth it? Maybe there's some other way to get the same benefits? Thanks. J.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ben Nadel
04/16/2007 05:44 PM

What if you use a ColdFusion struct to create the name/value pairs.... Then you might be able to call ".elements()" on to get the Enumertion as defined in: http://java.sun.com/j2se/1.4.2/docs/api/java/util/Hashtable.html What are you doing to do with it that a struct itself won't accomplish? ..................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ Hi, all. Any ideas on how to simulate enumerated types in CF? Is it even worth it? Maybe there's some other way to get the same benefits? Thanks. J.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
julian abiodun
04/17/2007 04:37 AM

Is a CF struct implemented as a Hashtable in Java? To be honest, I'm not doing anything specific right now that would require such a thing, but I'm always wondering how one might bend CF to simulate features in other programming languages. I was looking through some Java code that used enumerated types and was struck by the elegance of the language construct.  I work mostly in CF but spend a lot of time reading Java code because there are so many great texts on OOAD with examples in Java. ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ben Nadel
04/17/2007 08:49 AM

I think the ColdFusion struct extends the fast hash table. But don't quite remember off hand. Not all methods are available. ..................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ Is a CF struct implemented as a Hashtable in Java? To be honest, I'm not doing anything specific right now that would require such a thing, but I'm always wondering how one might bend CF to simulate features in other programming languages. I was looking through some Java code that used enumerated types and was struck by the elegance of the language construct.  I work mostly in CF but spend a lot of time reading Java code because there are so many great texts on OOAD with examples in Java.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Andrew Powell
09/30/2008 12:51 PM

I think struct could be too generic here. Depending on the goal usage List could be used. Functions like listgetat and listfind use and assign integer values to list elements. -aP >Hi, all. >Any ideas on how to simulate enumerated types in CF? >Is it even worth it? Maybe there's some other way to >get the same benefits? >Thanks. >J.


<< Previous Thread Today's Threads Next Thread >>

Search cf-oop

May 24, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference