org.optaplanner.core.impl.solver

## Class AbstractSolverFactory<Solution_>

- java.lang.Object
- - org.optaplanner.core.api.solver.SolverFactory<Solution_>
  - - org.optaplanner.core.impl.solver.AbstractSolverFactory<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
  Direct Known Subclasses:
    EmptySolverFactory, XStreamXmlSolverFactory

      public class AbstractSolverFactory<Solution_>
      extends SolverFactory<Solution_>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SolverConfig` | `solverConfig`
    `protected SolverConfigContext` | `solverConfigContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSolverFactory(SolverConfigContext solverConfigContext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Solver<Solution_>` | `buildSolver()` Creates a new `Solver` instance.
    `SolverFactory<Solution_>` | `cloneSolverFactory()` Build a `SolverFactory` quickly (without parsing XML) that builds the exact same `Solver` with `SolverFactory.buildSolver()`, but can also be modified with `SolverFactory.getSolverConfig()` to build a different `Solver` without affecting the original `SolverFactory`.
    `SolverConfig` | `getSolverConfig()` Allows you to programmatically change the `SolverConfig` at runtime before building the `Solver`.
    `SolverConfigContext` | `getSolverConfigContext()`

    - ### Methods inherited from class org.optaplanner.core.api.solver.SolverFactory

      `createEmpty, createEmpty, createEmptyFromKieContainer, createEmptyFromKieContainer, createFromKieContainerXmlResource, createFromKieContainerXmlResource, createFromKieContainerXmlResource, createFromXmlFile, createFromXmlFile, createFromXmlInputStream, createFromXmlInputStream, createFromXmlReader, createFromXmlReader, createFromXmlResource, createFromXmlResource`

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

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

- - ### Field Detail

    - #### solverConfigContext

          protected final SolverConfigContext solverConfigContext

    - #### solverConfig

          protected SolverConfig solverConfig

  - ### Constructor Detail

    - #### AbstractSolverFactory

          public AbstractSolverFactory(SolverConfigContext solverConfigContext)

  - ### Method Detail

    - #### getSolverConfigContext

          public SolverConfigContext getSolverConfigContext()

    - #### getSolverConfig

          public SolverConfig getSolverConfig()

      Description copied from class: `SolverFactory`
      Allows you to programmatically change the `SolverConfig` at runtime before building the `Solver`.

      This method is not thread-safe. To configure a `SolverConfig` differently for parallel requests, build a template `SolverFactory` from XML and clone it `SolverFactory.cloneSolverFactory()` for each request, before before calling this method.

      Specified by:
        `getSolverConfig` in class `SolverFactory<Solution_>`
      Returns:
        never null

    - #### buildSolver

          public Solver<Solution_> buildSolver()

      Description copied from class: `SolverFactory`
      Creates a new `Solver` instance.
      Specified by:
        `buildSolver` in class `SolverFactory<Solution_>`
      Returns:
        never null

    - #### cloneSolverFactory

          public SolverFactory<Solution_> cloneSolverFactory()

      Description copied from class: `SolverFactory`
      Build a `SolverFactory` quickly (without parsing XML) that builds the exact same `Solver` with `SolverFactory.buildSolver()`, but can also be modified with `SolverFactory.getSolverConfig()` to build a different `Solver` without affecting the original `SolverFactory`.
      Specified by:
        `cloneSolverFactory` in class `SolverFactory<Solution_>`
      Returns:
        never null, often a different `SolverFactory` subclass implementation than this instance

Copyright © 2006–2019 JBoss by Red Hat. All rights reserved.