Hi Jon,

No, the utility class is not dependent on the base class. The base class
has some universal methods that handle things like performing common
preInsert and preUpdate ORM methods across all my persistent objects. My
utility class has some common methods that I use for such things as
encryption/decrypt. I am need of some of the methods that are in the
utility class from within my base class. Since the base class is never call
directly or from my beanfactory (I use ColdSpring), I don't know how to
inject the utility class into the base class.

On Fri, Feb 6, 2015 at 2:23 PM, Jon Clausen <jon_clau...@silowebworks.com>
wrote:

>
> Dean,
>
> Is your utility class dependent on the the base class (e.g. - does it use
> “this” or the variables scope)?  If so, then you have a couple of 
> different
> ways you can go:
>
> 1) use it as a mixin inside your component{} , and forego the class
> wrapper for the Utility methods entirely:
>
> include template=“Utilities.cfm”;
>
> 2) use inheritance of the Utilities class on the base class (or the base
> class’ super class):
>
> component name=“BaseClass” extends=“UtilityClass”{}
>
> If it’s not dependent on the base class, you can either:
>
> 1) Inject it using a dependency framework like Wirebox (
> http://wiki.coldbox.org/wiki/WireBox.cfm - which can run outside of a
> Coldbox app), Coldspring, etc. ( I see Nathan just replied to this effect)
> and just call the injection mapping in your constructor.  If there are
> constructor arguments the Util class needs, you can set those with your
> injection framework and be done with them.
>
> 2) If the methods are all static helpers, incorporate it as a mixin to
> your Application.cfc, so that the methods become available globally,
> without scope, on every request.
>
>
> Jon
>
>
>

-- 

  [image: profile picture]  *Dean Lawrence*
*President*
Internet Data Technology
*Phone:* 888-438-4381 x701
*Web:* www.idatatech.com
*Email:* d...@idatatech.com
  Programming | Database | Consulting | Training


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360072
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to