Annotation Type 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 SummaryNested ClassesModifier and TypeClassDescriptionstatic @interfaceDefines severalShadowVariableannotations on the same element.static interfaceWorkaround for annotation limitation insourceEntityClass().
- 
Required Element SummaryRequired ElementsModifier and TypeRequired ElementDescriptionThe source variable name.Class<? extends AbstractVariableListener>AVariableListenerorListVariableListenergets notified after a source planning variable has changed.
- 
Optional Element SummaryOptional ElementsModifier and TypeOptional ElementDescriptionClass<?>ThePlanningEntityclass of the source variable.
- 
Element Details- 
variableListenerClassClass<? extends AbstractVariableListener> variableListenerClassAVariableListenerorListVariableListenergets 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:
- a variable listener class
 
- 
sourceVariableNameString sourceVariableNameThe source variable name.- Returns:
- never null, a genuine or shadow variable name
 
 
- 
- 
- 
sourceEntityClassClass<?> sourceEntityClassThePlanningEntityclass of the source variable.Specified if the source variable is on a different Classthan the class that uses this referencing annotation.- Returns:
- ShadowVariable.NullEntityClasswhen the attribute is omitted (workaround for annotation limitation). Defaults to the same- Classas the one that uses this annotation.
 - Default:
- org.optaplanner.core.api.domain.variable.ShadowVariable.NullEntityClass.class
 
 
-