Uploaded image for project: 'WINDUP - Red Hat Application Migration Toolkit'
  1. WINDUP - Red Hat Application Migration Toolkit
  2. WINDUP-218

Further simplification of iteration in rules

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.Beta2
    • 2.0.0.Alpha1
    • None
    • None
    • None

      Currently, the iteration looks like:

                              .addRule()
                              .when(JavaClass.references("org.jboss.forge.furnace.*").at(TypeReferenceLocation.IMPORT))
                              .perform(Iteration.over()
                                          .perform(Classification.classifyAs("Furnace Service")
                                                      .with(Link.to("JBoss Forge", "http://forge.jboss.org")).withEffort(0)
                                                  .and(Hint.havingText("Furnace type references imply that the client code must be run within a Furnace container.")
                                                           .withEffort(8)
                                                  .and(addTypeRefToList))
                                          ).endIteration()
                              );
      

      I suggest:

      .addRule()
      .forEach( JavaClass.references("org.jboss.forge.furnace.*").at(TypeReferenceLocation.IMPORT) )
      .perform(
              Classification.classifyAs("Furnace Service") .with(...),
              Hint.in("#{ref.file}").at("ref").withText(...),
              Hint.havingText(...).withEffort(8)
      )
      

      But something tells me this might need OCPrewrite API change.

      .addRule()
      .perform(
              For.each( JavaClass.references("org.jboss.forge.furnace.*").at(TypeReferenceLocation.IMPORT) ).perform(
                     Classification.classifyAs("Furnace Service") .with(...),
                     Hint.in("#{ref.file}").at("ref").withText(...),
                     Hint.havingText(...).withEffort(8)
              )
      )
      

              lincolnthree Lincoln Baxter III (Inactive)
              ozizka_jira Ondrej Zizka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: