public class JavaParser extends Object
Constructor and Description |
---|
JavaParser()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Iterable<? extends JavaFileObject> |
generate(JavaFileObject... sources)
Parses
sources into compilation units. |
Iterable<? extends JavaFileObject> |
generate(String className,
String code)
Parses
sources into compilation units. |
protected List<Processor> |
getAnnotationProcessors()
The list of processors to use.
|
protected BeanDefinitionInjectProcessor |
getBeanDefinitionInjectProcessor()
The
BeanDefinitionInjectProcessor to use. |
protected TypeElementVisitorProcessor |
getTypeElementVisitorProcessor()
The type element visitor processor to use.
|
Iterable<? extends Element> |
parse(JavaFileObject... sources)
Parses
sources into CompilationUnitTree units. |
Iterable<? extends Element> |
parseLines(String className,
String... lines)
Parses
sources into compilation units. |
Reader |
readGenerated(String filePath,
String className,
String code)
Reads the contents of a generated file as a reader.
|
public Iterable<? extends Element> parseLines(String className, String... lines)
sources
into compilation units. This method
does not compile the sources.className
- The class namelines
- The lines to parsepublic Iterable<? extends Element> parse(JavaFileObject... sources)
sources
into CompilationUnitTree
units. This method
does not compile the sources.sources
- The sourcespublic Iterable<? extends JavaFileObject> generate(String className, String code)
sources
into compilation units. This method
does not compile the sources.className
- The class namecode
- the raw code@Nullable public Reader readGenerated(@Nonnull String filePath, String className, String code) throws IOException
filePath
- The file pathclassName
- The class name that produces the filecode
- The code of the classIOException
- when an error occurs reading the filepublic Iterable<? extends JavaFileObject> generate(JavaFileObject... sources)
sources
into compilation units. This method
does not compile the sources.sources
- The sources@Nonnull protected List<Processor> getAnnotationProcessors()
@Nonnull protected BeanDefinitionInjectProcessor getBeanDefinitionInjectProcessor()
BeanDefinitionInjectProcessor
to use.BeanDefinitionInjectProcessor
@Nonnull protected TypeElementVisitorProcessor getTypeElementVisitorProcessor()