We use cookies to serve our customers and website visitors in the best possible way. Cookies are used for the proper functioning of the website and for improving the user experience, monitoring visitor traffic and marketing purposes. By continuing to browse the site, you agree to our use of cookies. You can read more about cookies here.
com.vaadin.copilot.javarewriter.
Package com.vaadin.copilot.javarewriter
Class InsertionPoint
java.lang.Object
com.vaadin.copilot.javarewriter.InsertionPoint
Represents a point in the source code where new code can be inserted.
-
Constructor Summary
ConstructorsConstructorDescriptionInsertionPoint
(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration declaration, int index) InsertionPoint
(com.github.javaparser.ast.stmt.BlockStmt block, int index) Creates a new InsertionPoint instance.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(com.github.javaparser.ast.stmt.Statement statement) Adds a statement to the insertion point.
com.github.javaparser.ast.stmt.BlockStmt
getBlock()
com.github.javaparser.ast.body.ClassOrInterfaceDeclaration
getFreeVariableName
(String baseName) Returns a free variable name based on the given base name, available in the scope where code will be inserted.
int
getIndex()
-
Constructor Details
-
InsertionPoint
public InsertionPoint(com.github.javaparser.ast.stmt.BlockStmt block, int index) Creates a new InsertionPoint instance.
Parameters:
block
- the block where to insert the codeindex
- the index where to insert the code -
InsertionPoint
public InsertionPoint(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration declaration, int index)
-
-
Method Details
-
getFreeVariableName
Returns a free variable name based on the given base name, available in the scope where code will be inserted.
Parameters:
baseName
- the base name for the variableReturns:
a free variable name
-
add
public void add(com.github.javaparser.ast.stmt.Statement statement) Adds a statement to the insertion point.
Parameters:
statement
- the statement to add -
getBlock
public com.github.javaparser.ast.stmt.BlockStmt getBlock() -
getIndex
public int getIndex() -
getDeclaration
public com.github.javaparser.ast.body.ClassOrInterfaceDeclaration getDeclaration()
-