6 Replies Latest reply on Mar 24, 2017 1:36 PM by gastaldi

    Format Java Source Code using Roaster.format

    manhaylaw0605

      String javaCode = "public class MyClass{ private String field;if(condition){return true;}else{return false;}}";

      String formattedCode = Roaster.format(javaCode);

      System.out.println(formattedCode);

       

      Can it return as:

       

      public class MyClass{

           private String field;

          

           if(condition){

                return true;

           }else{

                return false;

           }

      }

       

      I found it is only okay without the conditional statement in this case. Is it any way to do this formatting? Thank you.