Class GizmoSolutionClonerImplementor

java.lang.Object
ai.timefold.solver.core.impl.domain.solution.cloner.gizmo.GizmoSolutionClonerImplementor

public class GizmoSolutionClonerImplementor extends Object
  • Field Details

  • Constructor Details

    • GizmoSolutionClonerImplementor

      public GizmoSolutionClonerImplementor()
  • Method Details

    • getInstanceOfComparator

      public static Comparator<Class<?>> getInstanceOfComparator(Set<Class<?>> deepClonedClassSet)
      Return a comparator that sorts classes into instanceof check order. In particular, if x is a subclass of y, then x will appear earlier than y in the list.
      Parameters:
      deepClonedClassSet - The set of classes to generate a comparator for
      Returns:
      A comparator that sorts classes from deepClonedClassSet such that x < y if x is assignable from y.
    • withFallbackClonerField

    • defineClonerFor

      public static void defineClonerFor(io.quarkus.gizmo2.creator.ClassCreator classCreator, SolutionDescriptor<?> solutionDescriptor, Set<Class<?>> solutionClassSet, Map<Class<?>,GizmoSolutionOrEntityDescriptor> memoizedSolutionOrEntityDescriptorMap, Set<Class<?>> deepClonedClassSet)
      Generates the constructor and implementations of SolutionCloner methods for the given SolutionDescriptor using the given ClassCreator
    • isCloneableClass

      public static boolean isCloneableClass(Class<?> clazz)
    • defineClonerFor

      public static void defineClonerFor(Supplier<GizmoSolutionClonerImplementor> implementorSupplier, io.quarkus.gizmo2.creator.ClassCreator classCreator, SolutionDescriptor<?> solutionDescriptor, Set<Class<?>> solutionClassSet, Map<Class<?>,GizmoSolutionOrEntityDescriptor> memoizedSolutionOrEntityDescriptorMap, Set<Class<?>> deepClonedClassSet)
      Generates the constructor and implementations of SolutionCloner methods for the given SolutionDescriptor using the given ClassCreator
    • createClassOutputWithDebuggingCapability

      public static io.quarkus.gizmo2.ClassOutput createClassOutputWithDebuggingCapability(Map<String,byte[]> classBytecodeHolder)
    • createSetSolutionDescriptor

      protected void createSetSolutionDescriptor(GizmoSolutionClonerImplementor.ClonerDescriptor clonerDescriptor)
    • getEntityHelperMethodName

      protected static String getEntityHelperMethodName(Class<?> entityClass)
    • handleUnknownClass

      protected void handleUnknownClass(GizmoSolutionClonerImplementor.ClonerDescriptor clonerDescriptor, GizmoSolutionClonerImplementor.ClonerMethodDescriptor clonerMethodDescriptor, Class<?> entityClass, io.quarkus.gizmo2.Var toClone, Consumer<io.quarkus.gizmo2.creator.BlockCreator> knownClassHandler)
      Writes the following code:

      In Quarkus: (nothing)

      Outside Quarkus:

       if (toClone.getClass() != entityClass) {
           Cloner.fallbackCloner.gizmoFallbackDeepClone(toClone, cloneMap);
       } else {
           // code knownClassHandler produces
       }
       
    • createAbstractDeepCloneHelperMethod

      protected void createAbstractDeepCloneHelperMethod(GizmoSolutionClonerImplementor.ClonerDescriptor clonerDescriptor, Class<?> entityClass)