Annotation Interface 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.
This annotation is deprecated. Below are the instructions on how to replace your
@CustomShadowVariable(...)
with either @ShadowVariable
or @PiggybackShadowVariable
.
If your @CustomShadowVariable
uses the variableListenerClass
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 the variableListenerRef
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 more
PlanningVariable
s.
It is specified on a getter of a java bean property (or a field) of a PlanningEntity
class.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Deprecated, for removal: This API element is subject to removal in a future version.Workaround for annotation limitation invariableListenerClass()
. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionDeprecated, 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>
Deprecated, for removal: This API element is subject to removal in a future version.AVariableListener
gets notified after a source planning variable has changed.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 Details
-
variableListenerClass
Class<? extends VariableListener> variableListenerClassDeprecated, 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[] sourcesDeprecated, 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 variableListenerRefDeprecated, 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="")
-
ShadowVariable
(normal shadow variable withvariableListenerClass()
) andPiggybackShadowVariable
(ifvariableListenerRef()
is used).