Skip to content

Instantly share code, notes, and snippets.

@bittersweetryan
Created July 22, 2011 14:58
Show Gist options
  • Save bittersweetryan/1099615 to your computer and use it in GitHub Desktop.
Save bittersweetryan/1099615 to your computer and use it in GitHub Desktop.
Put Classloader in metadata
<cffunction name="setClassLoader" returntype="void" access="private" output="false" hint="I put this objects classloader into the metadata its only created once" >
<cfargument name="libs" type="array" required="true">
<cfscript>
//class loader doesn't exist yet
if(!structKeyExists(getMetaData(this),"classLoader"))
getMetaData(this).classLoader = createObject("component", "JavaLoader").init(arguments.libs);
instance.classLoader = getMetaData(this).classLoader;
</cfscript>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment