Package io.spring.javaformat.formatter
Class Formatter
- java.lang.Object
-
- org.eclipse.jdt.core.formatter.CodeFormatter
-
- io.spring.javaformat.formatter.Formatter
-
public class Formatter extends org.eclipse.jdt.core.formatter.CodeFormatterACodeFormatterthat applies Spring formatting conventions.- Author:
- Phillip Webb
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_LINE_SEPARATORThe default line separator.
-
Constructor Summary
Constructors Constructor Description Formatter()Create a new formatter instance.Formatter(FormatterOption... options)Create a new formatter instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateIndentationString(int indentationLevel)org.eclipse.text.edits.TextEditformat(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator)org.eclipse.text.edits.TextEditformat(int kind, String source, org.eclipse.jface.text.IRegion[] regions, int indentationLevel, String lineSeparator)org.eclipse.text.edits.TextEditformat(String source)Format the given source content.org.eclipse.text.edits.TextEditformat(String source, int offset, int length)Format a specific subsection of the given source content.org.eclipse.text.edits.TextEditformat(String source, int offset, int length, String lineSeparator)Format a specific subsection of the given source content.org.eclipse.text.edits.TextEditformat(String source, String lineSeparator)Format the given source content.org.eclipse.text.edits.TextEditformat(String source, org.eclipse.jface.text.IRegion[] regions)Format specific subsections of the given source content.org.eclipse.text.edits.TextEditformat(String source, org.eclipse.jface.text.IRegion[] regions, String lineSeparator)Format specific subsections of the given source content.voidsetOptions(Map<String,String> options)
-
-
-
Field Detail
-
DEFAULT_LINE_SEPARATOR
public static final String DEFAULT_LINE_SEPARATOR
The default line separator.
-
-
Constructor Detail
-
Formatter
public Formatter()
Create a new formatter instance.
-
Formatter
public Formatter(FormatterOption... options)
Create a new formatter instance.- Parameters:
options- formatter options
-
-
Method Detail
-
format
public org.eclipse.text.edits.TextEdit format(String source)
Format the given source content.- Parameters:
source- the source content to format- Returns:
- the text edit
-
format
public org.eclipse.text.edits.TextEdit format(String source, String lineSeparator)
Format the given source content.- Parameters:
source- the source content to formatlineSeparator- the line separator- Returns:
- the text edit
-
format
public org.eclipse.text.edits.TextEdit format(String source, int offset, int length)
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
public org.eclipse.text.edits.TextEdit format(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator)- Specified by:
formatin classorg.eclipse.jdt.core.formatter.CodeFormatter
-
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
public org.eclipse.text.edits.TextEdit format(int kind, String source, org.eclipse.jface.text.IRegion[] regions, int indentationLevel, String lineSeparator)- Specified by:
formatin classorg.eclipse.jdt.core.formatter.CodeFormatter
-
createIndentationString
public String createIndentationString(int indentationLevel)
- Overrides:
createIndentationStringin classorg.eclipse.jdt.core.formatter.CodeFormatter
-
-