org.optaplanner.core.impl.domain.solution.cloner

## Class FieldAccessingSolutionCloner<Solution_>

- java.lang.Object
- - org.optaplanner.core.impl.domain.solution.cloner.FieldAccessingSolutionCloner<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
  All Implemented Interfaces:
    SolutionCloner<Solution_>

      public class FieldAccessingSolutionCloner<Solution_>
      extends Object
      implements SolutionCloner<Solution_>

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `FieldAccessingSolutionCloner.FieldAccessingSolutionClonerRun`
    `protected static class` | `FieldAccessingSolutionCloner.Unprocessed`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ConcurrentMap<Class<?>,Boolean>` | `actualValueClassDeepClonedMemoization`
    `protected ConcurrentMap<Class<?>,Constructor<?>>` | `constructorMemoization`
    `protected ConcurrentMap<org.apache.commons.lang3.tuple.Pair<Field,Class<?>>,Boolean>` | `fieldDeepClonedMemoization`
    `protected ConcurrentMap<Class<?>,List<Field>>` | `fieldListMemoization`
    `protected SolutionDescriptor<Solution_>` | `solutionDescriptor`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldAccessingSolutionCloner(SolutionDescriptor<Solution_> solutionDescriptor)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Solution_` | `cloneSolution(Solution_ originalSolution)` Does a planning clone.
    `protected boolean` | `isClassDeepCloned(Class<?> type)`
    `protected boolean` | `isFieldAnEntityOrSolution(Field field, Class<?> fieldInstanceClass)`
    `protected boolean` | `isFieldAnEntityPropertyOnSolution(Field field, Class<?> fieldInstanceClass)`
    `protected <C> Constructor<C>` | `retrieveCachedConstructor(Class<C> clazz)` This method is thread-safe.
    `protected <C> List<Field>` | `retrieveCachedFields(Class<C> clazz)` This method is thread-safe.
    `protected boolean` | `retrieveDeepCloneDecision(Field field, Class<?> fieldInstanceClass, Class<?> actualValueClass)` This method is thread-safe.
    `protected boolean` | `retrieveDeepCloneDecisionForActualValueClass(Class<?> actualValueClass)` This method is thread-safe.

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

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

- - ### Field Detail

    - #### solutionDescriptor

          protected final SolutionDescriptor<Solution_> solutionDescriptor

    - #### constructorMemoization

          protected final ConcurrentMap<Class<?>,Constructor<?>> constructorMemoization

    - #### fieldListMemoization

          protected final ConcurrentMap<Class<?>,List<Field>> fieldListMemoization

    - #### fieldDeepClonedMemoization

          protected final ConcurrentMap<org.apache.commons.lang3.tuple.Pair<Field,Class<?>>,Boolean> fieldDeepClonedMemoization

    - #### actualValueClassDeepClonedMemoization

          protected final ConcurrentMap<Class<?>,Boolean> actualValueClassDeepClonedMemoization

  - ### Constructor Detail

    - #### FieldAccessingSolutionCloner

          public FieldAccessingSolutionCloner(SolutionDescriptor<Solution_> solutionDescriptor)

  - ### Method Detail

    - #### cloneSolution

          public Solution_ cloneSolution(Solution_ originalSolution)

      Description copied from interface: `SolutionCloner`
      Does a planning clone. The returned `PlanningSolution` clone must fulfill these requirements:
      - The clone must represent the same planning problem. Usually it reuses the same instances of the problem facts and problem fact collections as the `original`.
      - The clone must have the same (equal) score as the `original`.
      - The clone must use different, cloned instances of the entities and entity collections. If a cloned entity changes, the original must remain unchanged. If an entity is added or removed in a cloned `PlanningSolution`, the original `PlanningSolution` must remain unchanged.
      Note that a class might support more than 1 clone method: planning clone is just one of them.

      This method is thread-safe.

      Specified by:
        `cloneSolution` in interface `SolutionCloner<Solution_>`
      Parameters:
        `originalSolution` - never null, the original `PlanningSolution`
      Returns:
        never null, the cloned `PlanningSolution`

    - #### retrieveCachedConstructor

          protected <C> Constructor<C> retrieveCachedConstructor(Class<C> clazz)

      This method is thread-safe.
      Type Parameters:
        `C` - type
      Parameters:
        `clazz` - never null
      Returns:
        never null

    - #### retrieveCachedFields

          protected <C> List<Field> retrieveCachedFields(Class<C> clazz)

      This method is thread-safe.
      Type Parameters:
        `C` - type
      Parameters:
        `clazz` - never null
      Returns:
        never null

    - #### retrieveDeepCloneDecision

          protected boolean retrieveDeepCloneDecision(Field field,
                                                      Class<?> fieldInstanceClass,
                                                      Class<?> actualValueClass)

      This method is thread-safe.
      Parameters:
        `field` - never null
        `fieldInstanceClass` - never null
        `actualValueClass` - never null
      Returns:
        never null

    - #### isFieldAnEntityPropertyOnSolution

          protected boolean isFieldAnEntityPropertyOnSolution(Field field,
                                                              Class<?> fieldInstanceClass)

    - #### isFieldAnEntityOrSolution

          protected boolean isFieldAnEntityOrSolution(Field field,
                                                      Class<?> fieldInstanceClass)

    - #### retrieveDeepCloneDecisionForActualValueClass

          protected boolean retrieveDeepCloneDecisionForActualValueClass(Class<?> actualValueClass)

      This method is thread-safe.
      Parameters:
        `actualValueClass` - never null
      Returns:
        never null

    - #### isClassDeepCloned

          protected boolean isClassDeepCloned(Class<?> type)

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