Annotation Type CustomShadowVariable
-
@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface CustomShadowVariable
Specifies that a bean property (or a field) is a custom shadow of 1 or morePlanningVariable's.It is specified on a getter of a java bean property (or a field) of a
PlanningEntityclass.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description PlanningVariableReference[]sourcesThe source variables (leaders) that trigger a change to this shadow variable (follower).Class<? extends VariableListener>variableListenerClassAVariableListenergets notified after a source planning variable has changed.PlanningVariableReferencevariableListenerRefUse this when this shadow variable is updated by theVariableListenerof anotherCustomShadowVariable.
-
-
-
Element Detail
-
variableListenerClass
Class<? extends VariableListener> variableListenerClass
AVariableListenergets 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.- Returns:
- never null (unless
variableListenerRef()is not null)
- Default:
- org.optaplanner.core.api.domain.variable.CustomShadowVariable.NullVariableListener.class
-
-
-
sources
PlanningVariableReference[] sources
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
Use this when this shadow variable is updated by theVariableListenerof anotherCustomShadowVariable.- Returns:
- null if (and only if) any of the other fields is non null.
- Default:
- @org.optaplanner.core.api.domain.variable.PlanningVariableReference(variableName="")
-
-