http://www.jindent.com |
|
Next: Try/Catch |
Brace style for enumeration declarations |
Left brace { new line |
public enum Season { ... |
public enum Season { ... |
Right brace } new line |
Indent left brace { |
public·enum·Season ····{ ····... |
public·enum·Season { ... |
public·enum·Season·{ ... |
public·enum·Season{ ... |
Indent right brace } |
public·enum·Season ····{ ····... ····} |
public·enum·Season { ····... } |
Indent after right brace } |
Cuddle braces of empty blocks {} |
public enum Season {} |
public enum Season { } |
Indent cuddled braces {} |
public·enum·Season{} |
public·enum·Season·{} |
Prohibit blank lines after left brace { |
public enum Season { ¶ // comment with a preceding blank line WINTER, SPRING, SUMMER, FALL; ¶ // another comment ... } |
public enum Season { // comment with a preceding blank line WINTER, SPRING, SUMMER, FALL; ¶ // another comment ... } |
See also: | Jindent - Settings - Formatter - Java / SQLJ - Blank Lines - Comments , Jindent - Settings - Formatter - Java / SQLJ - Blank Lines |
If number of lines in body is at least ... then insert blank line after { |
public enum Season { WINTER,SPRING,SUMMER,FALL; } ¶ public enum Color { RED,GREEN,BLUE; static final Map colorMap = new HashMap(); static{ for(Color c : Color.values()){ colorMap.put(c.toString(), c); } } } |
Season
looks fine,
but enumeration Color
seems to be formatted too close:
The enumeration head public enum Color {
and the first elements declaration
RED,GREEN,BLUE;
are connected too close and could cause confusion.
public enum Season { WINTER,SPRING,SUMMER,FALL; } ¶ public enum Color { ¶ RED,GREEN,BLUE; static final Map colorMap = new HashMap(); static{ for(Color c : Color.values()){ colorMap.put(c.toString(), c); } } } |
Color
seems to be much clearer and
enumeration Season
is still formatted as before.
public enum Season { ¶ WINTER,SPRING,SUMMER,FALL; } ¶ public enum Color { ¶ RED,GREEN,BLUE; static final Map colorMap = new HashMap(); static{ for(Color c : Color.values()){ colorMap.put(c.toString(), c); } } } |
infinite
.If number of lines in body is at least ... then insert blank line before } |
public enum Season { WINTER,SPRING,SUMMER,FALL; } ¶ public enum Color { ¶ RED,GREEN,BLUE; static final Map colorMap = new HashMap(); static{ for(Color c : Color.values()){ colorMap.put(c.toString(), c); } } ¶ } |
Do not insert blank line before single left brace |
See also: | Jindent - Settings - Formatter - Java / SQLJ - Braces Style - Presets |