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



title
5.6.1.2.3 Switch-Case

Indent case from switch

Indent case from switch

There are several conventions which use different styles of switch-case indentation. This option can control indentation of case blocks from its switch token.


Setting indent case from switch to value 4:

switch(a)·{                             
····case·1:                             
········System.out.println("one");      
········break;                          
····case·2:                             
········System.out.println("two");      
········break;                          
····case·3:                             
········System.out.println("three");    
········break;                          
····default:                            
}                                       


Indent case from switch with value 0:

switch(a)·{                             
case·1:                                 
····System.out.println("one");          
····break;                              
case·2:                                 
····System.out.println("two");          
····break;                              
case·3:                                 
····System.out.println("three");        
····break;                              
default:                                
}                                       

See also... See also: White space before colons in switch-case blocks




Indent block { ... } from case

Indent block { ... } from case

Indents case declarations starting with blocks { ... } from the case label.

Setting indent block from case to value 4:

switch(a)·{                             
····case·1:·                            
    ····
{                               
    
········System.out.println("one");  
    
········break;                      
    
····}                               
                                        
····case·2:                             
    
····{                               
    
········System.out.println("two");  
    
········break;                      
    
····}                               
                                        
····case·3:                             
    
····{                               
    
········System.out.println("three");
    
········break;                      
    
····}                               
                                        
····default:                            
}                                       


Indent block from case to value 0:

switch(a)·{                             
····case·1:·                            
····
{                                   
········System.out.println("one");      
········break;                          
····}                                   
                                        
····case·2:                             
····{                                   
········System.out.println("two");      
········break;                          
····}                                   
                                        
····case·3:                             
····{                                   
········System.out.println("three");    
········break;                          
····}                                   
                                        
····default:                            
}