コード例 #1
0
 private void processValueRangeAnnotation() {
   Method propertyGetter = variablePropertyAccessor.getReadMethod();
   ValueRange valueRangeAnnotation = propertyGetter.getAnnotation(ValueRange.class);
   ValueRanges valueRangesAnnotation = propertyGetter.getAnnotation(ValueRanges.class);
   if (valueRangeAnnotation != null) {
     if (valueRangesAnnotation != null) {
       throw new IllegalArgumentException(
           "The planningEntityClass ("
               + planningEntityDescriptor.getPlanningEntityClass()
               + ") has a PlanningVariable annotated property ("
               + variablePropertyAccessor.getName()
               + ") that has a @ValueRange and @ValueRanges annotation: fold them into 1 @ValueRanges.");
     }
     valueRangeDescriptor = buildValueRangeDescriptor(valueRangeAnnotation);
   } else {
     if (valueRangesAnnotation == null) {
       throw new IllegalArgumentException(
           "The planningEntityClass ("
               + planningEntityDescriptor.getPlanningEntityClass()
               + ") has a PlanningVariable annotated property ("
               + variablePropertyAccessor.getName()
               + ") that has no @ValueRange or @ValueRanges annotation.");
     }
     List<PlanningValueRangeDescriptor> valueRangeDescriptorList =
         new ArrayList<PlanningValueRangeDescriptor>(valueRangesAnnotation.value().length);
     for (ValueRange partialValueRangeAnnotation : valueRangesAnnotation.value()) {
       valueRangeDescriptorList.add(buildValueRangeDescriptor(partialValueRangeAnnotation));
     }
     valueRangeDescriptor =
         new CompositePlanningValueRangeDescriptor(this, valueRangeDescriptorList);
   }
 }
コード例 #2
0
 private void processPropertyAnnotations() {
   PlanningVariable planningVariableAnnotation =
       variablePropertyAccessor.getReadMethod().getAnnotation(PlanningVariable.class);
   valueSorter = new PlanningValueSorter();
   processNullable(planningVariableAnnotation);
   processStrength(planningVariableAnnotation);
   processChained(planningVariableAnnotation);
   processValueRangeAnnotation();
 }