Jindent - Java Source Code Formatter http://www.jindent.com
 



title
5.6.1.9.5 Statements

Wrap after for-each colon :

Wrap after for-each colon :

Controls line wrapping of colons in for-statements.



"Maximal line length" is set to 70 and line wrapping for colons in for-statemens is set to always:

public class ClassA {                                                 |
    
public void method() {                                            |
        
for (MyVariable variableName :                                |
                
getCollectionFromSomewhere(a, b, c, d, e, f)) {       |
            
// ...                                                    |
        
}                                                             |
    
}                                                                 |
}                                                                     |



"Maximal line length" is set to 70 and line wrapping for colons is set to never:

public class ClassA {                                                 |
    
public void method() {                                            |
        
for (MyVariable variableName : getCollectionFromSomewhere(a, b, 
                c, d, e, f)) {
                                        |
            
// ...                                                    |
        
}                                                             |
    
}                                                                 |
}                                                                     |



"Maximal line length" is set to 70 and line wrapping for colons is set to on demand:

public class ClassA {                                                 |
    
public void method() {                                            |
        
for (MyVariable variableName :                                |
                
getCollectionFromSomewhere(a, b, c, d, e, f)) {       |
            
// ...                                                    |
        
}                                                             |
    
}                                                                 |
}                                                                     |



"Maximal line length" is set to 60 and line wrapping for colons is set to if line exceeds:

public class ClassA {                                       |
    
public void method() {                                  |
        
for (MyVariable variableName :                      |
                
getCollectionFromSomewhere(a, b, c, d, e,   |
                                           
f)) {            |
            
// ...                                          |
        
}                                                   |
    
}                                                       |
}                                                           |




Wrap after points . on demand

Wrap after points . on demand

Enables line wrapping of long import statements on demand.

Sample with line wrapping enabled:

import aaa.bbb.ccc.ddd.eee.fff.ggg.hhh.iii.jjj.kkk.lll.mmm.nnn.ooo.ppp.qqq.rrr  |
    
.sss.ttt.uuu.vvv.www.xxx.yyy.zzz.*;                                         |
import aaa.bbb.ccc.ddd.eee.fff.ggg.hhh.iii.jjj.kkk.lll.mmm.nnn.ooo.ppp.qqq.rrr  |
    
.sss.ttt.uuu.vvv.www.xxx.yyy.zzz.BigClassName;                              |


The same sample with line wrapping disabled:

import aaa.bbb.ccc.ddd.eee.fff.ggg.hhh.iii.jjj.kkk.lll.mmm.nnn.ooo.ppp.qqq.rrr.sss.ttt.uuu.vvv.www.xxx.yyy.zzz.*;
import aaa.bbb.ccc.ddd.eee.fff.ggg.hhh.iii.jjj.kkk.lll.mmm.nnn.ooo.ppp.qqq.rrr.sss.ttt.uuu.vvv.www.xxx.yyy.zzz.BigClassName;



Wrap after left parentheses ( on demand

Wrap after left parentheses ( on demand

Determines whether line breaks are allowed after left parentheses or not.


Do not allow wrapping after left parentheses:

if (x == 0                                                                  |
{                                                                             |
    
stringBuffer = new StringBuffer("a pretty long String value which is not easy to wrap");
}
                                                                             |


Allow wrapping after left parentheses:

if (x == 0                                                                  |
{                                                                             |
    
stringBuffer = new StringBuffer(                                          |
        
"a pretty long String value which is not easy to wrap");              |
}                                                                             |