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

    Format Java Source Code using Roaster.format

    Jason Law Newbie

      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.