Class ClassSourceStaticAnalyzer

java.lang.Object
com.vaadin.copilot.javarewriter.ClassSourceStaticAnalyzer

public class ClassSourceStaticAnalyzer extends Object
Static source file parser for the given component class. See findCreateLocationCandidateOrThrow(VaadinSession)
  • Constructor Details

    • ClassSourceStaticAnalyzer

      public ClassSourceStaticAnalyzer(ComponentSourceFinder sourceFinder, com.vaadin.flow.component.Component component, File file)
      Parameters:
      sourceFinder - to get children of the given component if necessary
      component - Component instance that is created with
      file - Source file of the component
  • Method Details

    • findCreateLocationCandidateOrThrow

      public com.vaadin.flow.component.internal.ComponentTracker.Location findCreateLocationCandidateOrThrow(com.vaadin.flow.server.VaadinSession vaadinSession) throws IOException
      Determines the candidate create location. There are three ways to find the candidate, it is done in the following order:

      1. Using the reference of children create locations to find candidate constructor
      2. Returning default constructor if present
      3. Returning class declaration as fallback

      Throws an exception if no candidate found from approaches above
      Returns:
      Create location of the given source file
      Throws:
      IOException - thrown if file operation fails