@@ -203,8 +203,6 @@ public String getInstanceNameSuffix() {
203203 * A set of strings used for categorizing related recipes. For example
204204 * "testing", "junit", "spring". Any individual tag should consist of a
205205 * single word, all lowercase.
206- *
207- * @return The tags.
208206 */
209207 @ Getter
210208 final Set <String > tags = emptySet ();
@@ -225,11 +223,21 @@ public final RecipeDescriptor getDescriptor() {
225223
226224 protected RecipeDescriptor createRecipeDescriptor () {
227225 List <OptionDescriptor > options = getOptionDescriptors ();
228- ArrayList <RecipeDescriptor > recipeList1 = new ArrayList <>();
229- for (Recipe next : getRecipeList ()) {
230- recipeList1 .add (next .getDescriptor ());
226+ List <RecipeDescriptor > preconditionDescriptors = emptyList ();
227+ if (this instanceof RecipePreconditions ) {
228+ RecipePreconditions recipeWithPreconditions = (RecipePreconditions ) this ;
229+ List <Recipe > preconditions = recipeWithPreconditions .getPreconditions ();
230+ preconditionDescriptors = new ArrayList <>(preconditions .size ());
231+ for (Recipe precondition : preconditions ) {
232+ preconditionDescriptors .add (precondition .getDescriptor ());
233+ }
234+ }
235+
236+ List <Recipe > recipeList = getRecipeList ();
237+ List <RecipeDescriptor > recipeDescriptors = new ArrayList <>(recipeList .size ());
238+ for (Recipe next : recipeList ) {
239+ recipeDescriptors .add (next .getDescriptor ());
231240 }
232- recipeList1 .trimToSize ();
233241
234242 URI recipeSource ;
235243 try {
@@ -239,7 +247,7 @@ protected RecipeDescriptor createRecipeDescriptor() {
239247 }
240248
241249 return new RecipeDescriptor (getName (), getDisplayName (), getInstanceName (), getDescription (), getTags (),
242- getEstimatedEffortPerOccurrence (), options , recipeList1 , getDataTableDescriptors (),
250+ getEstimatedEffortPerOccurrence (), options , preconditionDescriptors , recipeDescriptors , getDataTableDescriptors (),
243251 getMaintainers (), getContributors (), getExamples (), recipeSource );
244252 }
245253
@@ -449,12 +457,7 @@ public final RecipeRun run(LargeSourceSet before, ExecutionContext ctx, int maxC
449457
450458 @ SuppressWarnings ("unused" )
451459 public Validated <Object > validate (ExecutionContext ctx ) {
452- Validated <Object > validated = validate ();
453-
454- for (Recipe recipe : getRecipeList ()) {
455- validated = validated .and (recipe .validate (ctx ));
456- }
457- return validated ;
460+ return validate ();
458461 }
459462
460463 /**
@@ -475,9 +478,6 @@ public Validated<Object> validate() {
475478 validated = Validated .invalid (field .getName (), null , "Unable to access " + clazz .getName () + "." + field .getName (), e );
476479 }
477480 }
478- for (Recipe recipe : getRecipeList ()) {
479- validated = validated .and (recipe .validate ());
480- }
481481 return validated ;
482482 }
483483
@@ -561,6 +561,10 @@ public Recipe withOptions(@Nullable Map<String, Object> options) {
561561 Map <String , Object > option = new HashMap <>();
562562 option .put ("value" , value );
563563 objectMapper .updateValue (optionDescriptor , option );
564+
565+ if (optionDescriptor .getType ().equals ("List" )) {
566+ m .put (optionDescriptor .getName (), Arrays .asList (((String ) value ).split ("," )));
567+ }
564568 }
565569 }
566570 }
0 commit comments