}
}
protected <T, K> T applyTrait( K core, Class<T> trait, boolean logical ) throws LogicalTypeInconsistencyException {
AbstractRuleBase arb = (AbstractRuleBase) ((KnowledgeBaseImpl) this.getKnowledgeRuntime().getKieBase() ).getRuleBase();
TraitFactory builder = arb.getConfiguration().getComponentFactory().getTraitFactory();
boolean needsWrapping = ! ( core instanceof TraitableBean );
TraitableBean<K,? extends TraitableBean> inner = needsWrapping ? asTraitable( core, builder ) : (TraitableBean<K,? extends TraitableBean>) core;
if ( needsWrapping ) {