Class BeanCodeGen


  • public class BeanCodeGen
    extends java.lang.Object
    Code generator for the beans.

    This reads in a .java file, parses it, and writes out an updated version.

    • Constructor Summary

      Constructors 
      Constructor Description
      BeanCodeGen​(java.util.List<java.io.File> files, BeanGenConfig config, int verbosity, boolean write)
      Creates the generator for a single bean.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BeanCodeGen createFromArgs​(java.lang.String[] args)
      Creates an instance of BeanCodeGen from arguments.
      static void main​(java.lang.String[] args)
      Main method.
      int process()
      Processes the file, recursing as necessary, generating the source code.
      java.util.List<java.io.File> processFiles()
      Processes the file, recursing as necessary, generating the source code.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BeanCodeGen

        public BeanCodeGen​(java.util.List<java.io.File> files,
                           BeanGenConfig config,
                           int verbosity,
                           boolean write)
        Creates the generator for a single bean.

        To generate, use process().

        Parameters:
        files - the files to process, not null
        config - the configuration to use, not null
        verbosity - the verbosity, from 0 to 3
        write - whether to write or not
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        Main method.

        This calls System.exit.

        Parameters:
        args - the arguments, not null
      • createFromArgs

        public static BeanCodeGen createFromArgs​(java.lang.String[] args)
        Creates an instance of BeanCodeGen from arguments.

        This is intended for tools and does not call System.exit.

        Parameters:
        args - the arguments, not null
        Returns:
        the code generator, not null
        Throws:
        java.lang.RuntimeException - if unable to create
      • process

        public int process()
                    throws java.lang.Exception
        Processes the file, recursing as necessary, generating the source code.

        The number of altered files is returned.

        Returns:
        the number of changed files
        Throws:
        java.lang.Exception - if an error occurs
      • processFiles

        public java.util.List<java.io.File> processFiles()
                                                  throws java.lang.Exception
        Processes the file, recursing as necessary, generating the source code.

        The list of altered files is returned.

        Returns:
        the list of changed files, not null
        Throws:
        java.lang.Exception - if an error occurs