I just recently ditched cfinvoke for something similar to this:

                <cfset var metadata = getTransfer().getTransferMetaData
(getClassName()) />
                <cfset var keys = ''/>
                <cfset var key = ''/>
                <cfset var method = ''/>
                <cfset var value = ''/>

                <cfset keys = StructKeyList(arguments)/>

                <cfloop list="#keys#" index="key">

                        <cfif StructKeyExists(variables,'set#key#')>

                                <cfset method = variables['set#key#']/>
                                <cfset value = arguments[key]>

                                <cfset method(value)/>

                        </cfif>

                </cfloop>

so instead of using this I use the variables scope and instead of
using cfinvoke I just call the function directly.
It seems to perform better but I'm not 100% sure it's thread safe
yet...



On Nov 5, 5:41 pm, Cody Caughlan <[email protected]> wrote:
> I use this utility object to take a Struct of key/value pairs and call
> all setters on a given object which have a "setX" method where X is
> the name of a key in the Struct.
>
> http://gist.github.com/227407
>
> Used like:
>
> BeanUtil.populateBean(someObject, someStruct);
>
> Might be a little slower due to its usage of cfinvoke versus Evaluate()
>
> /Cody
>
> On Thu, Nov 5, 2009 at 2:00 PM, Bob Silverberg <[email protected]> 
> wrote:
> > Hmm, I've never even heard of listColumns().  If it were me, I'd use the
> > metadata that Transfer makes available for just this purpose. In case you
> > didn't see it, here's a link to a post I did about using Transfer's metadata
> > to create your own implementation of getMemento():
> >http://www.silverwareconsulting.com/index.cfm/2008/6/17/Using-Transfe...
>
> > Cheers,
> > Bob
>
> > On Thu, Nov 5, 2009 at 4:40 PM, Jim Rising <[email protected]> wrote:
>
> >> what about listColumns() ?
>
> >>     <cffunction name="copyTransferObject" output="false" hint="I copy one
> >> transfer object to another">
> >>         <cfargument name="aObject" required="true"
> >> type="transfer.com.TransferObject">
> >>         <cfargument name="bObject" required="true"
> >> type="transfer.com.TransferObject">
> >>         <cfset var aObject = arguments.aObject>
> >>         <cfset var bObject = arguments.bObject>
>
> >>         <cfset bColumns = bObject.listColumns()>
> >>         <cfloop list="#bColumns#" index="columnName">
> >>             <cfset getter = "aObject.get#columnName#()">
> >>             <cfset columnValue =  Evaluate(getter)>
> >>             <cfset setter = 'bObject.set#columnName#("#columnValue#")'>
> >>             <cfset Evaluate(setter)>
> >>         </cfloop>
> >>         <cfreturn bObject />
> >>     </cffunction>
>
> >> On Thu, Nov 5, 2009 at 3:23 PM, Bob Silverberg <[email protected]>
> >> wrote:
>
> >>> I'm sure Mark will correct me if I'm mistaken, but I don't think you
> >>> should be calling setTransferObject() in your code.  I'm guessing you 
> >>> could
> >>> get yourself into all kinds of trouble.
>
> >>> On Thu, Nov 5, 2009 at 3:26 PM, John Watson <[email protected]> wrote:
>
> >>>> I'm actually running into issues of losing my decorator methods after
> >>>> using the setTransferObject(TO). I haven't had time to debug yet (as 
> >>>> this is
> >>>> not a production app yet).
> >>>> I do this inside a "myDecoratedObject" called someobject:
> >>>> <cfset TO = getTransfer().readByPropertyMap("myDecoratedObject",filter)
> >>>> />
> >>>> <cfif TO.getIsPersisted()>
> >>>>   <cfset setTransferObject(TO) />
> >>>> <cfelse>
> >>>>  <!--- code that initializes this object based on the filter and saves
> >>>> it --->
> >>>> </cfif>
> >>>> After running this code, randomly (haven't investigated yet; believe it
> >>>> somehow related to my filter). "someobject" loses all of its decorator
> >>>> methods until I clear the transfer cache.
> >>>> Bob, I read your blog post:
>
> >>>>http://www.silverwareconsulting.com/index.cfm/2008/7/22/How-I-Use-Tra...
> >>>> And i think I will try that out whenever I go back to working on my
> >>>> project. Thanks for the tip!
> >>>> Mark, any plans for implementing something similar?
> >>>> Thanks,
> >>>> John
> >>>> On Thu, Nov 5, 2009 at 12:11, Jim Rising <[email protected]>
> >>>> wrote:
>
> >>>>> Mark,
>
> >>>>> Thanks. I'll look into it a bit further.
>
> >>>>> -jim
>
> >>>>> On Thu, Nov 5, 2009 at 1:14 PM, Mark Mandel <[email protected]>
> >>>>> wrote:
>
> >>>>>> Probably because you are using a variety of undocumented badness :o(
>
> >>>>>> getMemento() , switching out the inner object if a Decorator... all
> >>>>>> sounds pretty bad if you ask me.
>
> >>>>>> I think Bob's approach of using his memento function is probably the
> >>>>>> way to go.
>
> >>>>>> Mark
>
> >>>>>> On Fri, Nov 6, 2009 at 6:07 AM, Jim Rising <[email protected]>
> >>>>>> wrote:
>
> >>>>>>> ok... so here is what I did in my decorator:
>
> >>>>>>>     <cffunction name="copyContentTemplate">
> >>>>>>>         <cfargument name="contentTemplate"
> >>>>>>> type="transfer.com.transferObject" required="true">
> >>>>>>> <cfset var contentTemplate = arguments.contentTemplate>
> >>>>>>>         <cfset var content = getTransfer().get("content.Content",
> >>>>>>> "")>
>
> >>>>>>>         <cfset content = setTransferObject(contentTemplate)>
> >>>>>>>     </cffunction>
>
> >>>>>>> now... this does seem to copy a 'contentTemplate' TO into a 'content'
> >>>>>>> TO without any issues, but when i attempt to save using the following:
>
> >>>>>>>     <cffunction name="saveContent" access="public" returntype="any">
> >>>>>>>         <cfargument name="content" type="transfer.com.transferObject"
> >>>>>>> required="true">
> >>>>>>>         <cfset var content = arguments.content>
>
> >>>>>>>         <cfset getTransfer().save(content)>
>
> >>>>>>>     </cffunction>
>
> >>>>>>> the object does not save.
>
> >>>>>>> any ideas?
>
> >>>>>>> -jim
>
> >>>>>>> On Thu, Oct 29, 2009 at 11:21 AM, John Watson <[email protected]>
> >>>>>>> wrote:
>
> >>>>>>>> Someone who knows a little more detail about how the caching works
> >>>>>>>> may say what I suggest is a bad a idea, but here's a method I've 
> >>>>>>>> used with
> >>>>>>>> no issues yet.
> >>>>>>>> Inside the decorator I've used the TO.setTransferObject(otherTO)
> >>>>>>>> method. Though both the setting object and the TO object are both 
> >>>>>>>> the same
> >>>>>>>> (IE: content/content).
> >>>>>>>> Another idea may be to use setMemento(mementoStruct)
> >>>>>>>> John
>
> >>>>>>>> On Thu, Oct 29, 2009 at 09:10, Jim Rising <[email protected]>
> >>>>>>>> wrote:
>
> >>>>>>>>> I'm needing to copy one TO to another TO, and wondered if anyone
> >>>>>>>>> had any ideas on the best way to do that? Basically I have one TO 
> >>>>>>>>> that needs
> >>>>>>>>> to serve as a 'template' of another.
>
> >>>>>>>>> Example:
>
> >>>>>>>>> I have a TO called 'contentTemplate' and another called 'content'.
> >>>>>>>>> I want to be able to create a 'content' object from the
> >>>>>>>>> 'contentTemplate' object.
>
> >>>>>>>>> I'm thinking I will need to just get / set everything between each
> >>>>>>>>> of them, but was hoping I would have another option available.
>
> >>>>>>>>> Thanks!
> >>>>>>>>> --
> >>>>>>>>> Jim Rising
> >>>>>>>>> Serial Entrepreneur
> >>>>>>>>> Software Engineer
> >>>>>>>>> Web Developer
>
> >>>>>>>>> "Knowledge work requires both autonomy and accountability."
>
> >>>>>>> --
> >>>>>>> Jim Rising
> >>>>>>> Serial Entrepreneur
> >>>>>>> Software Engineer
> >>>>>>> Web Developer
>
> >>>>>>> "Knowledge work requires both autonomy and accountability."
>
> >>>>>> --
> >>>>>> E: [email protected]
> >>>>>> T:http://www.twitter.com/neurotic
> >>>>>> W:www.compoundtheory.com
>
> >>>>> --
> >>>>> Jim Rising
> >>>>> Serial Entrepreneur
> >>>>> Software Engineer
> >>>>> Web Developer
>
> >>>>> "Knowledge work requires both autonomy and accountability."
>
> >>> --
> >>> Bob Silverberg
> >>>www.silverwareconsulting.com
>
> >> --
> >> Jim Rising
> >> Serial Entrepreneur
> >> Software Engineer
> >> Web Developer
>
> >> "Knowledge work requires both autonomy and accountability."
>
> > --
> > Bob Silverberg
> >www.silverwareconsulting.com
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to