Interface JavaParser


public interface JavaParser
Main interface for Roaster parser implementations.
Author:
Lincoln Baxter, III, George Gastaldi
  • Method Details

    • create

      <T extends JavaSource<?>> T create(Class<T> type)
      Create a new empty JavaSource instance.
      Type Parameters:
      T - the java type
      Parameters:
      type - desired source type for the java source
      Returns:
      either a instance of T or null if the JavaSource type is not supported by this JavaParser.
    • parseUnit

      JavaUnit parseUnit(String data)
      Read the given source and parse the data into a new JavaUnit instance.
      Parameters:
      data - the source to parse
      Returns:
      a JavaUnit or null if the data format is not recognised by this JavaParser
      Throws:
      ParserException - if the source coudn't be parsed
    • validateSnippet

      List<Problem> validateSnippet(String code)
      Checks which problems occur while parsing the provided source code.
      Parameters:
      code - the code to parse
      Returns:
      a list of problems which occurred (maybe empty but not null)