Package io.spring.javaformat.formatter
Class Formatter
java.lang.Object
io.spring.javaformat.formatter.Formatter
A code formatter that applies Spring formatting conventions.
- Author:
- Phillip Webb
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateIndentationString(int indentationLevel) org.eclipse.text.edits.TextEditorg.eclipse.text.edits.TextEditformat(int kind, String source, org.eclipse.jface.text.IRegion[] regions, int indentationLevel, String lineSeparator) org.eclipse.text.edits.TextEditFormat the given source content.org.eclipse.text.edits.TextEditFormat a specific subsection of the given source content.org.eclipse.text.edits.TextEditFormat a specific subsection of the given source content.org.eclipse.text.edits.TextEditFormat the given source content.org.eclipse.text.edits.TextEditFormat specific subsections of the given source content.org.eclipse.text.edits.TextEditFormat specific subsections of the given source content.voidsetOptions(Map<String, String> options)
-
Field Details
-
DEFAULT_LINE_SEPARATOR
The default line separator.
-
-
Constructor Details
-
Formatter
public Formatter()Create a new formatter instance. -
Formatter
public Formatter(io.spring.javaformat.config.JavaFormatConfig javaFormatConfig) Create a new formatter instance.- Parameters:
javaFormatConfig- the java format config to use
-
-
Method Details
-
format
Format the given source content.- Parameters:
source- the source content to format- Returns:
- the text edit
-
format
Format the given source content.- Parameters:
source- the source content to formatlineSeparator- the line separator- Returns:
- the text edit
-
format
Format a specific subsection of the given source content.- Parameters:
source- the source content to formatoffset- the offset to start formattinglength- the length to format- Returns:
- the text edit
-
format
public org.eclipse.text.edits.TextEdit format(String source, int offset, int length, String lineSeparator) Format a specific subsection of the given source content.- Parameters:
source- the source content to formatoffset- the offset to start formattinglength- the length to formatlineSeparator- the line separator- Returns:
- the text edit
-
format
-
format
public org.eclipse.text.edits.TextEdit format(String source, org.eclipse.jface.text.IRegion[] regions) Format specific subsections of the given source content.- Parameters:
source- the source content to formatregions- the regions to format- Returns:
- the text edit
-
format
public org.eclipse.text.edits.TextEdit format(String source, org.eclipse.jface.text.IRegion[] regions, String lineSeparator) Format specific subsections of the given source content.- Parameters:
source- the source content to formatregions- the regions to formatlineSeparator- the line separator- Returns:
- the text edit
-
format
-
createIndentationString
-
setOptions
-