Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  
  package com.google.code.joto.util;
  
  import java.io.File;
  import java.io.FileWriter;
 import java.util.Date;
 import java.util.List;
 

Author(s):
Edu Pereda
 
 public class ClassCreatorHelper
 {
     private static long scenaryNumber = System.currentTimeMillis();
 
 
     private final File outputSrcFolder;
 
     private final String outputPackageName;
 
     private final List<? extends CustomProcessoruserSuppliedProcessors;
 
     {
         this. = new File"." );
         this. = "";
          = new ReverseEngineerObject();
          = new LinkedList<CustomProcessor>();
     }
 
     public ClassCreatorHelperFile outputSrcFolderString outputPackageName,
                                List<? extends CustomProcessoruserSuppliedProcessors )
     {
         if ( !StringUtil.isJavaPackageoutputPackageName ) )
         {
             throw new IllegalArgumentException"Not a valid java package name. outputPackageName: "
                 + outputPackageName );
         }
         this. = userSuppliedProcessors == null ? new LinkedList<CustomProcessor>()
                                                                     : userSuppliedProcessors;
         this. = outputSrcFolder;
         this. = outputPackageName;
          = new ReverseEngineerObject();
     }
 
     public File extractToDummyObjectObject objectToProcessString classNamePrefixString classNameSuffix )
         throws IOException
     {
         ReverseEngineerObjectResponse generatedCode = .generateCodeobjectToProcess,
                                                                                            );
         ..printlngeneratedCode );
         File parentFolder = StringUtil.packageNameToFilethis.this. );
         parentFolder.mkdirs();
 
         String className = classNamePrefix + ++ + classNameSuffix;
         File autogeneratedClassFile = new FileparentFolderclassName + ".java" );
         if ( !autogeneratedClassFile.exists() )
         {
             PrintStream out = new PrintStreamautogeneratedClassFile );
             out.println"package " + this. + ";" );
             out.printlngeneratedCode.imports );
             out.println"/** " );
             out.println" * This class was automatically generated." );
             out.println" */" );
             out.println"class " + className + " {" );
             out.println" public static " + objectToProcess.getClass().getSimpleName() + " createInstance() {" );
             out.println" return (" );
             out.printlngeneratedCode.code );
             out.println" );" );
             out.println" }" );
             out.println"}" );
             out.close();
             ..println"autogeneratedClassFile: " + autogeneratedClassFile.getAbsolutePath() );
         }
         else
         {
             ..printlnautogeneratedClassFile + " already exists. Ignoring" );
             BufferedWriter out = new BufferedWriternew FileWriterautogeneratedClassFiletrue ) );
             out.append"\n// Appending this line because file " );
             out.appendautogeneratedClassFile.getAbsolutePath() );
             out.append" already existed. Current time is " );
             out.appendnew Date().toString() );
             out.append".\n" );
         }
         return autogeneratedClassFile;
     }

    

Returns:
the outputSrcFolder
    public File getOutputSrcFolder()
    {
        return ;
    }

    

Returns:
the outputPackageName
    public String getOutputPackageName()
    {
        return ;
    }
New to GrepCode? Check out our FAQ X