boolean needsWrapping = ! ( core instanceof TraitableBean );
ClassDefinition coreDef = lookupClassDefinition( core );
TraitableBean<K,? extends TraitableBean> inner = needsWrapping ? builder.asTraitable( core, coreDef ) : (TraitableBean<K,? extends TraitableBean>) core;
if ( needsWrapping ) {
InternalFactHandle h = (InternalFactHandle) lookupFactHandle( core );
InternalWorkingMemoryEntryPoint ep = h != null ? (InternalWorkingMemoryEntryPoint) h.getEntryPoint() : (InternalWorkingMemoryEntryPoint) ((StatefulKnowledgeSessionImpl)workingMemory).getEntryPoint("DEFAULT");
ObjectTypeConfigurationRegistry reg = ep.getObjectTypeConfigurationRegistry();
ObjectTypeConf coreConf = reg.getObjectTypeConf( ep.getEntryPoint(), core );
ObjectTypeConf innerConf = reg.getObjectTypeConf( ep.getEntryPoint(), inner );