Class AddInjectAnnotationToResourceConstructor

java.lang.Object
org.openrewrite.Recipe
com.atlassian.platform.recipes.rest.tov2.AddInjectAnnotationToResourceConstructor
All Implemented Interfaces:
Cloneable

public class AddInjectAnnotationToResourceConstructor extends org.openrewrite.Recipe
Recipe will examine the rest resource class files and will add javax.inject.Inject annotation to resource class constructor method Sometimes OSGi fails to create bean of rest resource class with error "NoSuchMethodException: Could not find a suitable constructor" Then adding javax.inject.Inject annotation to rest resource class constructor help OSGi to identify the constructor method. This recipe will find all the rest resource constructor methods where resource class has javax.inject.Inject.Path annotation and add @Inject annotation to it if it is not there. It will also add import of janax.inject.Inject to rest resource class too. This recipe will not add maven dependency for javax.inject.Inject package There is another recipe named com.atlassian.platform.recipes.rest.tov2.AddInjectAnnotationToResourceConstructorWithDependency to do it
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
     
  • Field Summary

    Fields inherited from class org.openrewrite.Recipe

    contributors, examples, PANIC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>
     

    Methods inherited from class org.openrewrite.Recipe

    addDataTable, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AddInjectAnnotationToResourceConstructor

      public AddInjectAnnotationToResourceConstructor()
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class org.openrewrite.Recipe
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getVisitor

      public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
      Overrides:
      getVisitor in class org.openrewrite.Recipe