Annotation Type CustomShadowVariable
-
@Deprecated(forRemoval=true) @Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface CustomShadowVariable
Deprecated, for removal: This API element is subject to removal in a future version.Deprecated in favor ofShadowVariable
(normal shadow variable withvariableListenerClass()
) andPiggybackShadowVariable
(ifvariableListenerRef()
is used).This annotation is deprecated. Below are the instructions on how to replace your@CustomShadowVariable(...)
with either@ShadowVariable
or@PiggybackShadowVariable
.If your
@CustomShadowVariable
uses thevariableListenerClass
attribute, then replace the annotation with one@ShadowVariable
annotation for each source@PlanningVariableReference
.For example,
@CustomShadowVariable( variableListenerClass = PredecessorsDoneDateUpdatingVariableListener.class, sources = { @PlanningVariableReference(variableName = "executionMode"), @PlanningVariableReference(variableName = "delay") })
becomes:@ShadowVariable( variableListenerClass = PredecessorsDoneDateUpdatingVariableListener.class, sourceVariableName = "executionMode") @ShadowVariable( variableListenerClass = PredecessorsDoneDateUpdatingVariableListener.class, sourceVariableName = "delay")
If your
@CustomShadowVariable
uses thevariableListenerRef
attribute, then replace it with the@PiggybackShadowVariable
annotation.For example,
@CustomShadowVariable( variableListenerRef = @PlanningVariableReference(variableName = "date"))
becomes:@PiggybackShadowVariable(shadowVariableName = "date")
Specifies that a bean property (or a field) is a custom shadow variable of 1 or morePlanningVariable
s.It is specified on a getter of a java bean property (or a field) of a
PlanningEntity
class.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description PlanningVariableReference[]
sources
Deprecated, for removal: This API element is subject to removal in a future version.The source variables (leaders) that trigger a change to this shadow variable (follower).Class<? extends VariableListener>
variableListenerClass
Deprecated, for removal: This API element is subject to removal in a future version.AVariableListener
gets notified after a source planning variable has changed.PlanningVariableReference
variableListenerRef
Deprecated, for removal: This API element is subject to removal in a future version.Use this when this shadow variable is updated by theVariableListener
of anotherCustomShadowVariable
.
-
-
-
Element Detail
-
variableListenerClass
Class<? extends VariableListener> variableListenerClass
Deprecated, for removal: This API element is subject to removal in a future version.AVariableListener
gets 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
VariableListener
to update the arrival times of all the trailing entities when an entity is changed.- Returns:
- never null (unless
variableListenerRef()
is not null)
- Default:
- org.optaplanner.core.api.domain.variable.CustomShadowVariable.NullVariableListener.class
-
-
-
sources
PlanningVariableReference[] sources
Deprecated, for removal: This API element is subject to removal in a future version.The source variables (leaders) that trigger a change to this shadow variable (follower).- Returns:
- never null (unless
variableListenerRef()
is not null), at least 1
- Default:
- {}
-
-
-
variableListenerRef
PlanningVariableReference variableListenerRef
Deprecated, for removal: This API element is subject to removal in a future version.Use this when this shadow variable is updated by theVariableListener
of anotherCustomShadowVariable
.- Returns:
- null if (and only if) any of the other fields is non null.
- Default:
- @org.optaplanner.core.api.domain.variable.PlanningVariableReference(variableName="")
-
-