Background
I am trying to create a function componentFromJsonthat can restore a component graph from JSON. I made a simple approach when I use getMetaDatato search for component properties to create the correct types.
The function will be used as: comp = componentFromJson(json, 'RootComponentType')
Problem
The problem is that the type of properties is not necessarily fully qualified, as namespaces can be imported, as shown below.
<cfimport path="some.namespace.Test">
<cfcomponent>
<cfproperty name="test" type="Test">
</cfcomponent>
When I try to execute createObject('Test')functions from the context componentFromJson, it obviously does not work, because the calling context has no import.
, factory invoke factory CFC, .
.
<cfscript>
parentCmp = createObject('SomeCmp');
parentCmp.createComponent = function (type) {
return createObject(type);
};
childCmp = invoke(parentCmp, 'createComponent', { type = 'Test' });
</cfscript>
, , - CFF ColdFusion , , . , .
?
, - ? , ? , ColdFusion, .