processExcludeUninitializedPlanningEntity(valueRangeAnnotation);
}
private void processSolutionProperty(ValueRange valueRangeAnnotation) {
String solutionProperty = valueRangeAnnotation.solutionProperty();
PlanningEntityDescriptor planningEntityDescriptor = variableDescriptor.getPlanningEntityDescriptor();
rangePropertyDescriptor = planningEntityDescriptor.getSolutionDescriptor()
.getPropertyDescriptor(solutionProperty);
if (rangePropertyDescriptor == null) {
String exceptionMessage = "The planningEntityClass ("
+ planningEntityDescriptor.getPlanningEntityClass()
+ ") has a PlanningVariable annotated property (" + variableDescriptor.getVariableName()
+ ") that refers to a solutionClass ("
+ planningEntityDescriptor.getSolutionDescriptor().getSolutionClass()
+ ") solutionProperty (" + solutionProperty
+ ") that does not exist.";
if (solutionProperty.length() >= 2 && Character.isUpperCase(solutionProperty.charAt(1))) {
String correctedSolutionProperty = solutionProperty.substring(0, 1).toUpperCase()
+ solutionProperty.substring(1);
exceptionMessage += " But it probably needs to be correctedSolutionProperty ("
+ correctedSolutionProperty + ") instead because the JavaBeans spec states" +
" the first letter should be a upper case if the second is upper case.";
}
throw new IllegalArgumentException(exceptionMessage);
}
if (!Collection.class.isAssignableFrom(rangePropertyDescriptor.getPropertyType())) {
throw new IllegalArgumentException("The planningEntityClass ("
+ planningEntityDescriptor.getPlanningEntityClass()
+ ") has a PlanningVariable annotated property (" + variableDescriptor.getVariableName()
+ ") that refers to a solutionClass ("
+ planningEntityDescriptor.getSolutionDescriptor().getSolutionClass()
+ ") solutionProperty (" + solutionProperty
+ ") that does not return a Collection.");
}
}