Package adams.core

Class PropertiesToCode

    • Field Detail

      • m_Copyright

        protected String m_Copyright
        the copyright string.
      • m_Package

        protected String m_Package
        the package of the class.
      • m_SimpleName

        protected String m_SimpleName
        the simple name of the class.
      • m_Comment

        protected String m_Comment
        the comment to use in the class javadoc.
      • m_Indentation

        protected int m_Indentation
        the indentation level.
    • Constructor Detail

      • PropertiesToCode

        public PropertiesToCode()
    • Method Detail

      • setCopyright

        public void setCopyright​(String value)
        Sets the copyright entity.
        Parameters:
        value - the entity owning the copyright
      • getCopyright

        public String getCopyright()
        Returns the copyright entity.
        Returns:
        the entity owning the copyright
      • copyrightTipText

        public String copyrightTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSimpleName

        public void setSimpleName​(String value)
        Sets the simple name (without package) of the class to generate.
        Parameters:
        value - the simple name
      • getSimpleName

        public String getSimpleName()
        Returns the simple name to use.
        Returns:
        the simple name
      • simpleNameTipText

        public String simpleNameTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPackage

        public void setPackage​(String value)
        Sets the package name of the class to generate.
        Parameters:
        value - the package name
      • getPackage

        public String getPackage()
        Returns the package name to use.
        Returns:
        the package name
      • packageTipText

        public String packageTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setComment

        public void setComment​(String value)
        Sets the comment to use for the class javadoc. If left empty, an auto-generated comment is used.
        Parameters:
        value - the comment
      • getComment

        public String getComment()
        Returns the comment to use for the class javadoc. If left empty, an auto-generated comment is used.
        Returns:
        the comment
      • commentTipText

        public String commentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setIndentation

        public void setIndentation​(int value)
        Sets the indentation.
        Parameters:
        value - the number of spaces
      • getIndentation

        public int getIndentation()
        Returns the indentation.
        Returns:
        the number of spaces
      • indentationTipText

        public String indentationTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getIndentation

        protected String getIndentation​(int level)
        Returns the indentation for code at the specified level.
        Parameters:
        level - the indentation level
        Returns:
        the indentation string
      • addLicensePreamble

        protected void addLicensePreamble​(StringBuilder output)
        Adds the license preamble.
        Parameters:
        output - the buffer to add to
      • addCopyright

        protected void addCopyright​(StringBuilder output)
        Adds the copyright notice.
        Parameters:
        output - the buffer to add to
      • addPackage

        protected void addPackage​(StringBuilder output)
        Adds the package for the generated code.
        Parameters:
        output - the buffer to add to
      • getRequiredImports

        protected List<String> getRequiredImports()
        Returns the classnames that are required for the code to work.
        Returns:
        the classes
      • addImports

        protected void addImports​(StringBuilder output)
        Adds the imports.
        Parameters:
        output - the buffer to add to
      • addClassJavadoc

        protected void addClassJavadoc​(StringBuilder output)
        Adds the Javadoc for the class.
        Parameters:
        output - the buffer to add to
      • escapeDoubleQuotes

        protected String escapeDoubleQuotes​(String s)
        Properly escapes double quotes.
        Parameters:
        s - the string to process
        Returns:
        the processed string
      • addClassStart

        protected void addClassStart​(StringBuilder output,
                                     Properties props,
                                     List<String> keys)
        Adds the start of the enclosing "class" statement, including constants and member variables.
        Parameters:
        output - the buffer to add to
        props - the properties to use
        keys - the ordered keys
      • addMethod

        protected void addMethod​(StringBuilder output,
                                 Properties props,
                                 List<String> keys)
        Adds the method that returns the properties (and instantiates if necessary).
        Parameters:
        output - the buffer to add to
        props - the properties to use
        keys - the ordered keys
      • addClassEnd

        protected void addClassEnd​(StringBuilder output)
        Adds the end of the enclosing "class" statement.
        Parameters:
        output - the buffer to add to
      • generate

        public String generate​(Properties props)
        Turns the properties object into Java code.
        Parameters:
        props - the properties to convert
        Returns:
        the generated code