/** * This is a factory method for this AccumulateFunction configuration. * The factory method is a best practice for the case where the * actual object construction is changed in the future. * * @param name the name of the function to be configured * * @return the actual type safe accumulate function configuration. */ public static AccumulateFunctionOption get( final String name, final AccumulateFunction function ) { return new AccumulateFunctionOption( name, function ); }
public <T extends KnowledgeBuilderOption> void setOption(T option) { if ( option instanceof DefaultDialectOption ) { this.defaultDialect = (DefaultDialectOption) option; } else if ( option instanceof AccumulateFunctionOption ) { this.accumulateFunctions.put( ((AccumulateFunctionOption) option).getName(), ((AccumulateFunctionOption) option).getFunction() ); } else if ( option instanceof DumpDirOption ) { this.dumpDirectory = ((DumpDirOption) option).getDirectory(); } else if ( option instanceof EvaluatorOption ) { this.evaluatorRegistry.addEvaluatorDefinition( (EvaluatorDefinition) ((EvaluatorOption)option).getEvaluatorDefinition() ); } else if ( option instanceof ProcessStringEscapesOption ) { this.processStringEscapes = ((ProcessStringEscapesOption) option).isProcessStringEscapes(); } else if ( option instanceof DefaultPackageNameOption ) { setDefaultPackageName( ((DefaultPackageNameOption) option).getPackageName() ); } else if ( option instanceof ClassLoaderCacheOption ) { setClassLoaderCacheEnabled( ((ClassLoaderCacheOption) option).isClassLoaderCacheEnabled() ); } else if ( option instanceof KBuilderSeverityOption ) { this.severityMap.put(((KBuilderSeverityOption) option).getName(), ((KBuilderSeverityOption) option).getSeverity()); } else if ( option instanceof PropertySpecificOption ) { propertySpecificOption = (PropertySpecificOption)option; } }
public <T extends KnowledgeBuilderOption> void setOption(T option) { CommandImpl cmd = new CommandImpl( "execute", Arrays.asList( new Object[]{CommandFactory.newKnowledgeBuilderSetPropertyCommand(instanceId, option.getPropertyName(), ((AccumulateFunctionOption)option).getFunction().getClass().getCanonicalName())} ) ); ConversationUtil.sendMessage( this.grid.get(ConversationManager.class), (InetSocketAddress) this.gsd.getAddresses().get( "socket" ).getObject(), this.gsd.getId(), cmd ); }
@SuppressWarnings("unchecked") public <T extends MultiValueKnowledgeBuilderOption> T getOption(Class<T> option, String key) { if ( AccumulateFunctionOption.class.equals( option ) ) { return (T) AccumulateFunctionOption.get( key, this.accumulateFunctions.get( key ) ); } else if ( EvaluatorOption.class.equals( option ) ) { return (T) EvaluatorOption.get( key, this.evaluatorRegistry.getEvaluatorDefinition( key ) ); } else if ( KBuilderSeverityOption.class.equals( option )) { return (T) KBuilderSeverityOption.get( key, this.severityMap.get( key )); } return null; }
public static org.kie.internal.builder.conf.KnowledgeBuilderOption adaptOption(KnowledgeBuilderOption option) { if (option instanceof AccumulateFunctionOption) { AccumulateFunctionOption legacyOption = (AccumulateFunctionOption)option; return org.kie.internal.builder.conf.AccumulateFunctionOption.get(legacyOption.getName(), new AccumulateFunctionAdapter(legacyOption.getFunction()));
if ( this.accumulateFunctions != null && !this.accumulateFunctions.isEmpty() ) { for ( Entry<String, AccumulateFunction> entry : this.accumulateFunctions.entrySet() ) { kconf.setOption( AccumulateFunctionOption.get( entry.getKey(), entry.getValue() ) );
/** * This is a factory method for this AccumulateFunction configuration. * The factory method is a best practice for the case where the * actual object construction is changed in the future. * * @param name the name of the function to be configured * * @return the actual type safe accumulate function configuration. */ public static AccumulateFunctionOption get( final String name, final AccumulateFunction function ) { return new AccumulateFunctionOption( name, function ); }
if ( this.accumulateFunctions != null && !this.accumulateFunctions.isEmpty() ) { for ( Entry<String, AccumulateFunction> entry : this.accumulateFunctions.entrySet() ) { kconf.setOption( AccumulateFunctionOption.get( entry.getKey(), entry.getValue() ) );
/** * This is a factory method for this AccumulateFunction configuration. * The factory method is a best practice for the case where the * actual object construction is changed in the future. * * @param name the name of the function to be configured * * @return the actual type safe accumulate function configuration. */ public static AccumulateFunctionOption get( final String name, final AccumulateFunction function ) { return new AccumulateFunctionOption( name, function ); }