Class BeanCodeGen


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

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

    • Constructor Detail

      • BeanCodeGen

        public BeanCodeGen​(List<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​(String[] args)
        Main method.

        This calls System.exit.

        Parameters:
        args - the arguments, not null
      • createFromArgs

        public static BeanCodeGen createFromArgs​(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:
        RuntimeException - if unable to create
      • process

        public int process()
                    throws 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:
        Exception - if an error occurs
      • processFiles

        public List<File> processFiles()
                                throws 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:
        Exception - if an error occurs