@@ -653,13 +653,13 @@ def __init__(self, *,
653653
654654class DeepPlanningClone (JavaAnnotation ):
655655 """
656- Marks a problem fact class as being required to be deep planning cloned.
657- Not needed for a `planning_solution` or `planning_entity` because those are automatically deep cloned.
658- It can also mark an attribute as being required to be deep planning cloned.
656+ Marks an attribute as being required to be deep planning cloned.
659657 This is especially useful for `list` (or `dict`) properties.
660658 Not needed for a `list` (or `dist`) attribute with a generic type of `planning_entity`,
661659 because those are automatically deep cloned.
662660
661+ To annotate a class, use @deep_planning_clone
662+
663663 Notes
664664 -----
665665 If it annotates an attribute returning `list` (or `dict`),
@@ -873,6 +873,32 @@ def constraint_configuration(constraint_configuration_class: Type[Solution_]) ->
873873 out = add_class_annotation (JavaConstraintConfiguration )(constraint_configuration_class )
874874 return out
875875
876+ def deep_planning_clone (entity_class : Type [A ] = None ) -> Type [A ]:
877+ """
878+ Marks a problem fact class as being required to be deep planning cloned.
879+ Not needed for a `planning_solution` or `planning_entity` because those are automatically deep cloned.
880+
881+ To annotate an attribute, use DeepPlanningClone
882+
883+ Examples
884+ --------
885+ >>> from timefold.solver.domain import deep_planning_clone
886+ >>>
887+ >>> @deep_planning_clone
888+ ... @dataclass
889+ ... class Timeslot:
890+ ... day_of_week: str
891+ ... start_time: time
892+ ... end_time: time
893+ """
894+ ensure_init ()
895+ from _jpyinterpreter import add_class_annotation
896+ from .._timefold_java_interop import _add_to_compilation_queue
897+ from ai .timefold .solver .core .api .domain .solution .cloner import (
898+ DeepPlanningClone as JavaDeepPlanningClone )
899+ out = add_class_annotation (JavaDeepPlanningClone )(entity_class )
900+ _add_to_compilation_queue (entity_class )
901+ return out
876902
877903__all__ = ['PlanningId' , 'PlanningScore' , 'PlanningPin' , 'PlanningPinToIndex' ,
878904 'PlanningVariable' , 'PlanningVariableGraphType' , 'PlanningListVariable' ,
@@ -883,4 +909,4 @@ def constraint_configuration(constraint_configuration_class: Type[Solution_]) ->
883909 'PlanningEntityProperty' , 'PlanningEntityCollectionProperty' ,
884910 'ValueRangeProvider' , 'DeepPlanningClone' , 'ConstraintConfigurationProvider' ,
885911 'ConstraintWeight' ,
886- 'planning_entity' , 'planning_solution' , 'constraint_configuration' ]
912+ 'planning_entity' , 'planning_solution' , 'constraint_configuration' , 'deep_planning_clone' ]
0 commit comments