Package org.kie.internal.builder

## Class KnowledgeBuilderFactory

- java.lang.Object
- - org.kie.internal.builder.KnowledgeBuilderFactory

-     public class KnowledgeBuilderFactory
      extends java.lang.Object

  This factory is used to build the knowledge base resources that are held collectively in KnowledgePackages. The KnowledgePackage also provides the role of 'namespacing'. An optional KnowlegeBuilderConfiguration can be supplied. The KnowledgeBuilderConfiguration is itself created from this factory. The KnowledgeBuilderConfiguration allows you to set the ClassLoader to be used along with other setting like the default dialect and compiler, as well as many other options.

       KnowledgeBuilder kbuilder = KnowlegeBuilderFactory.newKnowledgeBuilder();

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `KnowledgeBuilderFactory()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static DecisionTableConfiguration` | `newDecisionTableConfiguration()` | DecisionTable resources require a ResourceConfiguration, that configuration instance is created here.
    `static JaxbConfiguration` | `newJaxbConfiguration​(com.sun.tools.xjc.Options xjcOpts, java.lang.String systemId)` |
    `static KnowledgeBuilder` | `newKnowledgeBuilder()` | Create and return a new KnowledgeBuilder, using the default KnowledgeBuilderConfigurations
    `static KnowledgeBuilder` | `newKnowledgeBuilder​(org.kie.api.KieBase kbase)` |
    `static KnowledgeBuilder` | `newKnowledgeBuilder​(org.kie.api.KieBase kbase, KnowledgeBuilderConfiguration conf)` |
    `static KnowledgeBuilder` | `newKnowledgeBuilder​(KnowledgeBuilderConfiguration conf)` | Create and return a new KnowledgeBuilder, using he given KnowledgeBuilderConfigurations
    `static KnowledgeBuilderConfiguration` | `newKnowledgeBuilderConfiguration()` | Create a KnowledgeBuilderConfiguration on which properties can be set.
    `static KnowledgeBuilderConfiguration` | `newKnowledgeBuilderConfiguration​(java.lang.ClassLoader classLoader)` |
    `static KnowledgeBuilderConfiguration` | `newKnowledgeBuilderConfiguration​(java.util.Properties properties, java.lang.ClassLoader classLoader)` | Create a KnowledgeBuilderConfiguration on which properties can be set.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KnowledgeBuilderFactory

          public KnowledgeBuilderFactory()

  - ### Method Detail

    - #### newKnowledgeBuilder

          public static KnowledgeBuilder newKnowledgeBuilder()

      Create and return a new KnowledgeBuilder, using the default KnowledgeBuilderConfigurations
      Returns:
        The KnowledgeBuilder

    - #### newKnowledgeBuilder

          public static KnowledgeBuilder newKnowledgeBuilder​(KnowledgeBuilderConfiguration conf)

      Create and return a new KnowledgeBuilder, using he given KnowledgeBuilderConfigurations
      Returns:
        The KnowledgeBuilder

    - #### newKnowledgeBuilder

          public static KnowledgeBuilder newKnowledgeBuilder​(org.kie.api.KieBase kbase)

    - #### newKnowledgeBuilder

          public static KnowledgeBuilder newKnowledgeBuilder​(org.kie.api.KieBase kbase,
                                                             KnowledgeBuilderConfiguration conf)

    - #### newKnowledgeBuilderConfiguration

          public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration()

      Create a KnowledgeBuilderConfiguration on which properties can be set.
      Returns:
        The KnowledgeBuilderConfiguration.

    - #### newKnowledgeBuilderConfiguration

          public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration​(java.lang.ClassLoader classLoader)

    - #### newKnowledgeBuilderConfiguration

          public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration​(java.util.Properties properties,
                                                                                       java.lang.ClassLoader classLoader)

      Create a KnowledgeBuilderConfiguration on which properties can be set. Use the given properties file and ClassLoader - either of which can be null.
      Returns:
        The KnowledgeBuilderConfiguration.

    - #### newDecisionTableConfiguration

          public static DecisionTableConfiguration newDecisionTableConfiguration()

      DecisionTable resources require a ResourceConfiguration, that configuration instance is created here. Note that if you are passing a Reader, you must use an InputStreamReader so the encoding can be determined.

           KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
           DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
           dtconf.setInputType( DecisionTableInputType.XLS );
           dtconf.setWorksheetName( "Tables_2" );
           kbuilder.add( new URL( "file://IntegrationExampleTest.xls" ),
                                 ResourceType.DTABLE,
                                 dtconf );
           assertFalse( kbuilder.hasErrors() );
           KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();

      Returns:

    - #### newJaxbConfiguration

          public static JaxbConfiguration newJaxbConfiguration​(com.sun.tools.xjc.Options xjcOpts,
                                                               java.lang.String systemId)