Reputation: 109
Using Boolean planning variable defined in the planning entity as:
@PlanningVariable(nullable = true, valueRangeProviderRefs = {"selectedRange"})
public Boolean getSelected() {
return selected;
}
public void setSelected(Boolean selected) {
this.selected = selected;
}
and in the planning solution I define the value range provider as:
@ValueRangeProvider(id = "selectedRange")
List<Boolean> getValueRange() {
return Arrays.asList(Boolean.FALSE, Boolean.TRUE);
}
public List<Boolean> getBooleanList() {
return selectedList;
}
public void setBooleanList(List<Boolean> selectedList) {
this.selectedList = selectedList;
}
I received the following error:
Exception in thread "AWT-EventQueue-0"
java.lang.IllegalArgumentException:The
entityClass
has aPlanningVariable
annotated property (selected) with avalueRangeProviderRef
(selectedRange) that does not exist on a registeredPlanningSolution
orPlanningEntity
.The
valueRangeProviderRef
(selectedRange) does not appear invalueRangeProvideIds
([]).
I can't recognize the problem cause.
Upvotes: 3
Views: 255
Reputation: 27312
Normally I would say: You're missing a @ValueRangeProvider
on a property of your solution class. But it looks like you have it. For some reason it's just not picking up it when it reflects over your planning solution class.
A) If you're using a 6.3.0.Final
or later, your code should work. If you're using an older version, it's probably because the getValueRange()
method isn't public (6.3 fixes that IIRC).
B) If the getValueRange()
method is defined on a superclass instead of on the actual planning solution class, then it will only work if that superclass is known as a proper planning solution class too IIRC.
Upvotes: 4