Class PackageTemplate

java.lang.Object
eu.bandm.tools.tdom.Template
eu.bandm.tools.tdom.PackageTemplate

class PackageTemplate extends Template
Tdom central data model for a generated package. There is one(1) per tdom run. It contains central configuration info, and the growing data structure representing the generated code. It is given as a parameter to all other [XX]Template objects created. (Please note that the structure of metajava objects grows in parallel, in sync!-)
In a first phase its local fields and esp. its metaPackage are filled, -- mainly by the Visitor code in TypedDOMGenerator. In a second phase it is written to the destination by the local code write(int).
  • Field Details

    • dtdFile

      @Opt final @Opt File dtdFile
    • destination

      final File destination
    • packageName

      final String packageName
    • dtd

      final DTD.Dtd dtd
    • elementIndex

      final ElementIndex elementIndex
    • attlistIndex

      final AttlistIndex attlistIndex
    • useArrays

      final boolean useArrays
    • generateFunctions

      final boolean generateFunctions
    • paisleySupport

      final boolean paisleySupport
    • hasAttributes

      final boolean hasAttributes
    • hasDocPIs

      boolean hasDocPIs
    • docPIs

      final Map<String,String> docPIs
      Maps a compiled class, by its internal "qname", to the concatenation of the texts of all related doc PIs.
    • allDocPIs

      final PreimageMap<DTD.PI,String> allDocPIs
      Maps PI to the docPiKey, for detecting ill-formed.
    • visitorTemplate

      protected VisitorTemplate visitorTemplate
    • abstractDocumentTemplate

      protected DocumentTemplate abstractDocumentTemplate
  • Constructor Details

  • Method Details

    • init

      void init()
      Generates and initializes all singular structures. These are metaPackage, extensionClass, dtdTemplate, visitorTemplate, dumperTemplate, abstractDocumentTemplate, sourcesFile, abstractElementTemplate. For some of them, "init()" is called.
    • finish

      void finish()
    • dtdFileRelativePosition

      String dtdFileRelativePosition()
    • write

      void write(int lineWidth)
    • getBaseClass

      MetaType getBaseClass()
      Returns the correctly instantiated "tdom.runtime.TypedElement" type. (The generated "[PKG]/Element" class can be accessed by abstractElementTemplate and getGeneratedBaseClass().)
    • getGeneratedBaseClass

      MetaType getGeneratedBaseClass()
    • repetitiveClass

      protected MetaType repetitiveClass(MetaClass contentClass, int modifier)
    • getDTD

      DTD.Dtd getDTD()
    • getElementIndex

      ElementIndex getElementIndex()
    • getAttlistIndex

      AttlistIndex getAttlistIndex()
    • getMetaPackage

      GeneratedPackage getMetaPackage()
    • getDestinationDirectory

      public File getDestinationDirectory()
    • getDTDTemplate

      DTDTemplate getDTDTemplate()
    • getVisitorTemplate

      VisitorTemplate getVisitorTemplate()
    • getDumperTemplate

      DumperTemplate getDumperTemplate()
    • getAbstractElementTemplate

      AbstractElementTemplate getAbstractElementTemplate()
    • getElementTemplate

      ToplevelTemplate getElementTemplate(String tagName)
    • getElementTemplates

      Collection<ToplevelTemplate> getElementTemplates()
    • getSuperElementTemplate

      AbstractElementTemplate getSuperElementTemplate(String tagName)
    • isAbstractElement

      boolean isAbstractElement(String tagName)
    • getAbstractReference

      DTD.Singleton getAbstractReference(DTD.CP cp)
    • addAbstractElement

      void addAbstractElement(String qname)
    • addElement

      ElementTemplate addElement(DTD.Element element, NamespaceName nname, boolean isPublic)
    • addAbstractElement

      AbstractElementTemplate addAbstractElement(String name, boolean isPublic, MetaClass superClass)
    • getSuperClasses

      Map<String,String> getSuperClasses()
    • getSuperClassName

      String getSuperClassName(String tagName)
    • setSuperClass

      void setSuperClass(String subClass, String superClass)
      ATTENTION both Strings are un-mangled, DTD style element identifiers.
    • foldAbstractElements

      Set<String> foldAbstractElements(Collection<String> children)
    • nextTagIndex

      int nextTagIndex()
    • getElementTagIndex

      int getElementTagIndex(NamespaceName name)
    • getExtendedTagIndex

      int getExtendedTagIndex(String name)
    • isExtensible

      boolean isExtensible()
    • generateExtensionClass

      GeneratedClass generateExtensionClass()
    • getExtensionClass

      GeneratedClass getExtensionClass()
    • addGetter

      void addGetter(int modifiers, GeneratedField field)
      Add a getter method to a Generated field. The return type and hosting class are copied from the field. The name is "get"+Capitalize(fieldname). Add user api doc, if doc mode enabled.
    • extractDoctext

      @Opt @Opt String extractDoctext(String key)
      Delivers the concatenation of all doc entries in the DTD related to the key.
      Global input: allDocPIs.
      Side-effect: removes all pis with this key for later error diagnosis of unprocessed pis.

      FIXME language should be switchable. FIXME css class should be switchable.

      Parameters:
      key - the pi-style identifier of the tdom element or attribute.
    • extractDoctextFormat

      @Opt @Opt Format extractDoctextFormat(String key)