Annotation Interface ShadowVariable
@Target({METHOD,FIELD})
@Retention(RUNTIME)
@Repeatable(List.class)
public @interface ShadowVariable
Specifies that a bean property (or a field) is a custom shadow variable of 1 or more source variables.
The source variable may be a genuine
PlanningVariable, PlanningListVariable, or another shadow variable.
It is specified on a getter of a java bean property (or a field) of a PlanningEntity class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalShadowVariableannotations on the same element.static interfaceWorkaround for annotation limitation insourceEntityClass().static interfaceWorkaround for annotation limitation invariableListenerClass(). -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>Deprecated, for removal: This API element is subject to removal in a future version.Class<? extends AbstractVariableListener>
-
Element Details
-
supplierName
String supplierNamePreview feature.If set, this
ShadowVariableis a supplier variable, and it is a name of a method annotated withShadowSourcesthat computes the value of thisShadowVariable.If set,
variableListenerClass(),sourceEntityClass()andsourceVariableName()must all be unset.- Returns:
- the method that computes the value of this
ShadowVariable.
- Default:
- ""
-
variableListenerClass
@Deprecated(since="1.27.0", forRemoval=true) Class<? extends AbstractVariableListener> variableListenerClassDeprecated, for removal: This API element is subject to removal in a future version.AVariableListenerorListVariableListenergets notified after a source planning variable has changed. That listener changes the shadow variable (often recursively on multiple planning entities) accordingly. Those shadow variables should make the score calculation more natural to write.For example: VRP with time windows uses a
VariableListenerto update the arrival times of all the trailing entities when an entity is changed. Must not be set ifsupplierName()is set.- Returns:
ShadowVariable.NullVariableListenerwhen the attribute is omitted (workaround for annotation limitation). The variable listener class that computes the value of this shadow variable.
- Default:
- ai.timefold.solver.core.api.domain.variable.ShadowVariable.NullVariableListener.class
-
sourceEntityClass
Deprecated, for removal: This API element is subject to removal in a future version.ThePlanningEntityclass of the source variable.Specified if the source variable is on a different
Classthan the class that uses this referencing annotation.Must not be set if
supplierName()is set.- Returns:
ShadowVariable.NullEntityClasswhen the attribute is omitted (workaround for annotation limitation). Defaults to the sameClassas the one that uses this annotation.
- Default:
- ai.timefold.solver.core.api.domain.variable.ShadowVariable.NullEntityClass.class
-
sourceVariableName
Deprecated, for removal: This API element is subject to removal in a future version.The source variable name.Must not be set if
supplierName()is set.- Returns:
- never null, a genuine or shadow variable name
- Default:
- ""
-
supplierwithsourcesinstead.