Class ClassDefinition


  • public class ClassDefinition
    extends CodeDefinition
    INTERNAL:

    Purpose: Model a class for code generation purposes.

    Since:
    TopLink 3.0
    Author:
    James Sutherland
    • Field Detail

      • packageName

        protected String packageName
      • imports

        protected Vector imports
      • type

        protected int type
      • superClass

        protected String superClass
      • interfaces

        protected Vector interfaces
      • attributes

        protected Vector attributes
      • methods

        protected Vector methods
      • innerClasses

        protected Vector innerClasses
    • Constructor Detail

      • ClassDefinition

        public ClassDefinition()
    • Method Detail

      • addImport

        public void addImport​(String importStatement)
        The importStatement should be of the form "{packageName}.{shortName or '*'}"
      • addInnerClass

        public void addInnerClass​(ClassDefinition classDefinition)
      • addInterface

        public void addInterface​(String interfaceClassName)
      • calculateImports

        public void calculateImports()
        Parses the class definition, pulls out fully qualified class names, adds imports for them, and un-fully qualifies the class names. - Assumes that no imports have been previously added. - Assumes that all types have been fully qualified to start. - Will not unqualify ambiguous classes (java.util.Date and java.sql.Date). - Will not add imports for java.lang.* - Will not add imports for classes in the same package. - Will not parse method bodies, but will unqualify types it finds. ?? - Should unqualification occur during writing? That way, reflective definitions could take advantage.
      • getAttributes

        protected Vector getAttributes()
      • getImports

        protected Vector getImports()
      • getInnerClasses

        protected Vector getInnerClasses()
      • getInterfaces

        protected Vector getInterfaces()
      • getMethods

        protected Vector getMethods()
      • getPackageName

        public String getPackageName()
      • getSuperClass

        public String getSuperClass()
      • getType

        public int getType()
      • isInterface

        public boolean isInterface()
      • replaceInterface

        protected void replaceInterface​(String oldInterfaceName,
                                        String newInterfaceName)
      • setPackageName

        public void setPackageName​(String packageName)
      • setSuperClass

        public void setSuperClass​(String superClass)
        If the class to be generated is an interface, do not use this method. Instead, use addInterface(String) for each interface superclass.
      • setType

        public void setType​(int type)
      • sortImports

        protected void sortImports()
      • sortMethods

        protected void sortMethods()