public final class ASTRewriteFormatter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ASTRewriteFormatter.BlockContext |
static class |
ASTRewriteFormatter.ConstPrefix |
static class |
ASTRewriteFormatter.NodeMarker |
static interface |
ASTRewriteFormatter.Prefix |
| Constructor and Description |
|---|
ASTRewriteFormatter(NodeInfoStore placeholders,
RewriteEventStore eventStore,
java.util.Map options,
java.lang.String lineDelimiter) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
changeIndent(java.lang.String code,
int codeIndentLevel,
java.lang.String newIndent) |
int |
computeIndentUnits(java.lang.String line) |
java.lang.String |
createIndentString(int indentationUnits) |
static java.lang.String |
evaluateFormatterEdit(java.lang.String string,
TextEdit edit,
Position[] positions)
Evaluates the edit on the given string.
|
TextEdit |
formatString(int kind,
java.lang.String string,
int offset,
int length,
int indentationLevel) |
RewriteEventStore |
getEventStore() |
java.lang.String |
getFormattedResult(ASTNode node,
int initialIndentationLevel,
java.util.Collection resultingMarkers)
Returns the string accumulated in the visit formatted using the default formatter.
|
java.lang.String |
getIndentString(java.lang.String currentLine) |
int |
getIndentWidth() |
java.lang.String |
getLineDelimiter() |
NodeInfoStore |
getPlaceholders() |
int |
getTabWidth() |
public static final ASTRewriteFormatter.Prefix NONE
public static final ASTRewriteFormatter.Prefix SPACE
public static final ASTRewriteFormatter.Prefix ASSERT_COMMENT
public final ASTRewriteFormatter.Prefix VAR_INITIALIZER
public final ASTRewriteFormatter.Prefix METHOD_BODY
public final ASTRewriteFormatter.Prefix FINALLY_BLOCK
public final ASTRewriteFormatter.Prefix CATCH_BLOCK
public final ASTRewriteFormatter.Prefix ANNOT_MEMBER_DEFAULT
public final ASTRewriteFormatter.Prefix ENUM_BODY_START
public final ASTRewriteFormatter.Prefix ENUM_BODY_END
public final ASTRewriteFormatter.Prefix WILDCARD_EXTENDS
public final ASTRewriteFormatter.Prefix WILDCARD_SUPER
public final ASTRewriteFormatter.Prefix FIRST_ENUM_CONST
public final ASTRewriteFormatter.Prefix ANNOTATION_SEPARATION
public final ASTRewriteFormatter.Prefix PARAM_ANNOTATION_SEPARATION
public final ASTRewriteFormatter.Prefix LOCAL_ANNOTATION_SEPARATION
public final ASTRewriteFormatter.Prefix TYPE_ANNOTATION_SEPARATION
public final ASTRewriteFormatter.Prefix VARARGS
public final ASTRewriteFormatter.Prefix TRY_RESOURCES
public final ASTRewriteFormatter.Prefix TRY_RESOURCES_PAREN
public final ASTRewriteFormatter.BlockContext IF_BLOCK_WITH_ELSE
public final ASTRewriteFormatter.BlockContext IF_BLOCK_NO_ELSE
public final ASTRewriteFormatter.BlockContext ELSE_AFTER_STATEMENT
public final ASTRewriteFormatter.BlockContext ELSE_AFTER_BLOCK
public final ASTRewriteFormatter.BlockContext FOR_BLOCK
public final ASTRewriteFormatter.BlockContext WHILE_BLOCK
public final ASTRewriteFormatter.BlockContext DO_BLOCK
public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, java.util.Map options, java.lang.String lineDelimiter)
public NodeInfoStore getPlaceholders()
public RewriteEventStore getEventStore()
public int getTabWidth()
public int getIndentWidth()
public java.lang.String getLineDelimiter()
public java.lang.String getFormattedResult(ASTNode node, int initialIndentationLevel, java.util.Collection resultingMarkers)
node - The node to flatten.initialIndentationLevel - The initial indentation level.resultingMarkers - Resulting the updated NodeMarkers.public java.lang.String createIndentString(int indentationUnits)
public java.lang.String getIndentString(java.lang.String currentLine)
public java.lang.String changeIndent(java.lang.String code,
int codeIndentLevel,
java.lang.String newIndent)
public int computeIndentUnits(java.lang.String line)
public static java.lang.String evaluateFormatterEdit(java.lang.String string,
TextEdit edit,
Position[] positions)
string - The string to formatedit - The edit resulted from the code formatterpositions - Positions to update or null.java.lang.IllegalArgumentException - If the positions are not inside the string, a
IllegalArgumentException is thrown.public TextEdit formatString(int kind,
java.lang.String string,
int offset,
int length,
int indentationLevel)