Class AbstractGenerator

  • All Implemented Interfaces:
    Generator
    Direct Known Subclasses:
    AbstractJavaGenerator, CppGenerator

    abstract class AbstractGenerator
    extends java.lang.Object
    implements Generator
    Abstract base for all generators.
    Since:
    19 September, 2005
    Version:
    $Id: //open/util/resgen/src/org/eigenbase/resgen/AbstractGenerator.java#3 $
    Author:
    jhyde
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractGenerator​(java.io.File srcFile, java.io.File file)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void generateDoNotModifyHeader​(java.io.PrintWriter pw)  
      protected void generateGeneratedByBlock​(java.io.PrintWriter pw)  
      protected abstract void generateResource​(ResourceDef.Resource resource, java.io.PrintWriter pw)
      Generates code for a particular resource.
      protected abstract java.lang.String[] getArgTypes​(java.lang.String message)
      Returns the number and types of parameters in the given error message, expressed as an array of Strings (legal values are currently "String", "Number", "java.util.Date", and null) ordered by parameter number.
      protected java.lang.String getArgumentList​(java.lang.String message)  
      protected abstract java.lang.String getBaseClassName()
      Returns the fully-qualified name of the base class.
      protected abstract java.lang.String getClassName()
      Returns the fully-qualified name of the class being generated, for example "happy.BirthdayResource_en_US".
      protected java.io.File getFile()
      Returns the generator's output file.
      protected java.lang.String getParameterList​(java.lang.String message)
      Returns a parameter list string, e.g.
      protected java.lang.String getSrcFileForComment()
      Returns the XML or .properties source file, in a manner suitable for use in source code comments.
      void setScmSafeComments​(boolean enabled)
      Configures whether this generator will output comments that may be submitted to a source code management system.
      protected boolean useScmSafeComments()  
      • Methods inherited from class java.lang.Object

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

      • AbstractGenerator

        public AbstractGenerator​(java.io.File srcFile,
                                 java.io.File file)
    • Method Detail

      • setScmSafeComments

        public void setScmSafeComments​(boolean enabled)
        Description copied from interface: Generator
        Configures whether this generator will output comments that may be submitted to a source code management system. In general, it squelches comments indicating the file should not be checked in as well as comments change with each generation of the file (thereby avoiding merge conflicts).
        Specified by:
        setScmSafeComments in interface Generator
      • useScmSafeComments

        protected boolean useScmSafeComments()
      • generateResource

        protected abstract void generateResource​(ResourceDef.Resource resource,
                                                 java.io.PrintWriter pw)
        Generates code for a particular resource.
      • generateDoNotModifyHeader

        protected void generateDoNotModifyHeader​(java.io.PrintWriter pw)
      • generateGeneratedByBlock

        protected void generateGeneratedByBlock​(java.io.PrintWriter pw)
      • getFile

        protected java.io.File getFile()
        Returns the generator's output file. e.g., "BirthdayResource.java"
      • getSrcFileForComment

        protected java.lang.String getSrcFileForComment()
        Returns the XML or .properties source file, in a manner suitable for use in source code comments. Path information is stripped if SCM-safe comment style is enabled.
        See Also:
        setScmSafeComments(boolean)
      • getClassName

        protected abstract java.lang.String getClassName()
        Returns the fully-qualified name of the class being generated, for example "happy.BirthdayResource_en_US".
      • getBaseClassName

        protected abstract java.lang.String getBaseClassName()
        Returns the fully-qualified name of the base class.
      • getParameterList

        protected java.lang.String getParameterList​(java.lang.String message)
        Returns a parameter list string, e.g. "String p0, int p1".
      • getArgTypes

        protected abstract java.lang.String[] getArgTypes​(java.lang.String message)
        Returns the number and types of parameters in the given error message, expressed as an array of Strings (legal values are currently "String", "Number", "java.util.Date", and null) ordered by parameter number.
      • getArgumentList

        protected java.lang.String getArgumentList​(java.lang.String message)