TraitableBean<K,? extends TraitableBean> inner = needsWrapping ? asTraitable( core, builder ) : (TraitableBean<K,? extends TraitableBean>) core;
if ( needsWrapping ) {
InternalFactHandle h = (InternalFactHandle) lookupFactHandle( core );
InternalWorkingMemoryEntryPoint ep = h != null ? (InternalWorkingMemoryEntryPoint) h.getEntryPoint() : (InternalWorkingMemoryEntryPoint) workingMemory.getEntryPoints().get( "DEFAULT" );
ObjectTypeConfigurationRegistry reg = ep.getObjectTypeConfigurationRegistry();
ObjectTypeConf coreConf = reg.getObjectTypeConf( ep.getEntryPoint(), core );
ObjectTypeConf innerConf = reg.getObjectTypeConf( ep.getEntryPoint(), inner );
if ( coreConf.isTMSEnabled() ) {
innerConf.enableTMS();
}
if ( inner._getFieldTMS() != null && inner._getFieldTMS().needsInit() ) {
inner._getFieldTMS().init( workingMemory );