Beany.cfc: Part 2

I wrote earlier about my Beany component for handling Beans (especially immutable ones) easily. I thought this time I'd just cover a few extra little features that I've added to it to make it a bit easier to use.

Meta Data

Beany offers a few ways to know about the data it has, other than asking for fields directly.


This will return a comma-delimited list of the keys in the current instance of Beany.


This will return all of the data in the current instance of Beany as a structure.




Will return a boolean indicating whether or not the given property exists within the current instance of Beany (can be used with any string value).

Altering Data

Beyond the "set" methods, Beany also has other ways to change data, if the current instance is mutable.

Firstly, you might want to remove a property altogether. Easy enough:




Another thing that I run into is that I often want to add to some existing data in a bean. For this, I have a series of "AddTo" methods.

  • .AddToArray(property,value)
  • .AddToList(property,value,delimiter=",")
  • .AddToString(property,value)
  • .AddToStruct(property,key,value,overwrite="true")

In each case, Beany will create the property if it doesn't already exist and will add to it appropriately for the given data type.

That's it! Beany is a pretty simple little component and is part of my free com.sebtools package for ColdFusion. Let me know what you think!

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.