| java.lang.Object org.apache.bsf.util.cf.CodeFormatter
CodeFormatter | public class CodeFormatter (Code) | | A CodeFormatter bean is used to format raw Java code. It
indents, word-wraps, and replaces tab characters with an amount of space
characters equal to the size of the indentationStep property.
To create and use a CodeFormatter , you simply instantiate a
new CodeFormatter bean, and invoke
formatCode(Reader source, Writer target) with appropriate
arguments.
version: 1.0 author: Matthew J. Duftler |
Method Summary | |
public void | formatCode(Reader source, Writer target) Formats the code read from source , and writes the formatted
code to target . | public String | getDelimiters() Gets the set of delimiters. | public int | getIndentationStep() Gets the size of the indentation step. | public int | getMaxLineLength() Gets the maximum line length. | public String | getStickyDelimiters() Gets the set of sticky delimiters. | public void | setDelimiters(String newDelimiters) Sets the set of delimiters; default set is "(+" .
Each character represents one delimiter. | public void | setIndentationStep(int newIndentationStep) Sets the size of the indentation step; default size is 2 . | public void | setMaxLineLength(int newMaxLineLength) Sets the (desired) maximum line length; default length is
74 . | public void | setStickyDelimiters(String newStickyDelimiters) Sets the set of sticky delimiters; default set is "," .
Each character represents one sticky delimiter. |
DEFAULT_DELIM | final public static String DEFAULT_DELIM(Code) | | The default set of delimiters.
|
DEFAULT_MAX | final public static int DEFAULT_MAX(Code) | | The default maximum line length.
|
DEFAULT_STEP | final public static int DEFAULT_STEP(Code) | | The default size of the indentation step.
|
DEFAULT_S_DELIM | final public static String DEFAULT_S_DELIM(Code) | | The default set of sticky delimiters.
|
formatCode | public void formatCode(Reader source, Writer target)(Code) | | Formats the code read from source , and writes the formatted
code to target .
Parameters: source - where to read the unformatted code from. Parameters: target - where to write the formatted code to. |
setDelimiters | public void setDelimiters(String newDelimiters)(Code) | | Sets the set of delimiters; default set is "(+" .
Each character represents one delimiter. If a line is ready to be
word-wrapped and a delimiter is encountered, the delimiter will
appear as the first character on the following line.
A quotation mark, " or ' , opening a string
is always a delimiter, whether you specify it or not.
Parameters: newDelimiters - the new set of delimiters. See Also: CodeFormatter.getDelimiters |
setIndentationStep | public void setIndentationStep(int newIndentationStep)(Code) | | Sets the size of the indentation step; default size is 2 .
This is the number of spaces that lines will be indented (when appropriate).
Parameters: newIndentationStep - the new size of the indentation step. See Also: CodeFormatter.getIndentationStep |
setMaxLineLength | public void setMaxLineLength(int newMaxLineLength)(Code) | | Sets the (desired) maximum line length; default length is
74 .
If a token is longer than the requested maximum line length,
then the line containing that token will obviously be longer
than the desired maximum.
Parameters: newMaxLineLength - the new maximum line length. See Also: CodeFormatter.getMaxLineLength |
setStickyDelimiters | public void setStickyDelimiters(String newStickyDelimiters)(Code) | | Sets the set of sticky delimiters; default set is "," .
Each character represents one sticky delimiter. If a line is ready
to be word-wrapped and a sticky delimiter is encountered, the sticky
delimiter will appear as the last character on the current line.
A quotation mark, " or ' , closing a string
is always a sticky delimiter, whether you specify it or not.
Parameters: newStickyDelimiters - the new set of sticky delimiters. See Also: CodeFormatter.getStickyDelimiters |
|
|