Class UMod2java

java.lang.Object
eu.bandm.tools.umod.UMod2java

public class UMod2java extends Object
  • Field Details

    • targetClassLoader

      public static final ClassLoader targetClassLoader
      Only used for "EXT" declarations, not for implicit use of "java.util.*"
    • DOC_SEP

      public static final String DOC_SEP
      See Also:
    • F_DOC_SEP

      public static final Format F_DOC_SEP
    • docMissing_x

      public static final String docMissing_x
      See Also:
    • docMissing

      public static final String docMissing
      First sentence of default documentation text for classes and fields.
      See Also:
    • docDefault

      public static final String docDefault
      First sentence of default documentation text for generated entities which do not allow user doc. Currently these are only the INTERFACE signatures defined in umod.
      See Also:
    • FORMAT_null

      protected static final Format FORMAT_null
    • NAME_SAX_PARSER

      protected static final String NAME_SAX_PARSER
      See Also:
    • NAME_SAX_WRITER

      protected static final String NAME_SAX_WRITER
      See Also:
    • METHODNAME_GETFORMATHINT

      protected static final String METHODNAME_GETFORMATHINT
      See Also:
    • CLASSNAME_TREEGEN

      public static final String CLASSNAME_TREEGEN
      See Also:
    • MODIF_PACKAGE_ACCESSIBLE

      protected static final int MODIF_PACKAGE_ACCESSIBLE
      See Also:
    • MODIF_TOPCLASS

      protected static final int MODIF_TOPCLASS
      See Also:
    • MODIF_STATICCLASS

      protected static final int MODIF_STATICCLASS
      See Also:
    • MODIF_STATIC_CONST

      protected static final int MODIF_STATIC_CONST
      See Also:
    • MODIF_STATICFIELD

      protected static final int MODIF_STATICFIELD
      See Also:
    • MODIF_STATICFINALFIELD

      protected static final int MODIF_STATICFINALFIELD
      See Also:
    • MODIF_CALLABLE

      protected static final int MODIF_CALLABLE
      See Also:
    • MODIF_STATICCALLABLE

      protected static final int MODIF_STATICCALLABLE
      See Also:
    • suffix_srcDoc

      public static final String suffix_srcDoc
      See Also:
    • curforest

      protected UMod.Forest curforest
      GLO variable for the resolution of identifiers (local or exernal)
    • floatNotDouble

      protected boolean floatNotDouble
    • userDocLevel

      protected int userDocLevel
    • hasUserDoc

      protected boolean hasUserDoc
    • htmlDocText

      protected Types.HtmlDocText htmlDocText
      Visitor which delivers a HTML representation of a umod type. This includes navigation links for reference types, etc.
    • htmlPPfilename

      protected String htmlPPfilename
    • msg

    • msgCounter

      protected MessageCounter msgCounter
    • log_phase

      protected String log_phase
    • artificialPackages

      final Map<String,GeneratedPackage> artificialPackages
    • extUnderResolve

      final Set<UMod.ExtDeclaration> extUnderResolve
    • abstractSetFieldNotSupported

      final Format abstractSetFieldNotSupported
      Code generation for abstract fields:
                          curforest.concrete2abstractField: (set up by "Checker")
          A
             f ABSTRACT int    ** -->  int get_f(){throw new Excp...}  bool set_f(int){throw new ..}
                  [[OPT int]]  ^^                  [[return null]]
          | B1                 ||
             f int             *| -->  int get_f(){return f;}       bool set_f(int){...}
                                |      int f ; 
          | B2                  |
             f int              *
      
        
    • abstractGetFieldNotSupported

      final Format abstractGetFieldNotSupported
    • returnNull

      final Format returnNull
    • doubleColonComment

      public static final Format doubleColonComment
    • sonarqubeStringsEqual

      static final GeneratedAnnotation sonarqubeStringsEqual
    • CLASSNAME_TERM_PATTERNS

      public final String CLASSNAME_TERM_PATTERNS
      See Also:
    • NAMESTUB_PATTERN_TERM

      public final String NAMESTUB_PATTERN_TERM
      See Also:
    • NAMESTUB_PATTERN_CAST

      public final String NAMESTUB_PATTERN_CAST
      See Also:
    • class_term_patterns

      protected GeneratedClass class_term_patterns
    • WRAPPEDCLASS_SwingForester

      protected static final MetaClass WRAPPEDCLASS_SwingForester
    • WRAPPEDCLASS_SwingForester_LazyNode

      protected static final MetaClass WRAPPEDCLASS_SwingForester_LazyNode
    • WRAPPEDCLASS_swing_tree_TreeNode

      protected static final MetaClass WRAPPEDCLASS_swing_tree_TreeNode
    • dueToAlg

      protected static final Format dueToAlg
  • Constructor Details

    • UMod2java

      public UMod2java()
  • Method Details

    • findexternalclassforname

      protected static Class findexternalclassforname(String n)
      Only used for "EXT" declarations, not for implicit use of "java.util.*". Only called by "resolveExternals()".
    • canonicalFieldName

      @Deprecated public static String canonicalFieldName(UMod.FieldDef fd)
      Deprecated.
    • strictnessCheck

      protected static Format strictnessCheck(UMod.FieldDef fd)
    • fieldSetToString

      protected String fieldSetToString(Collection<UMod.FieldDef> coll, String sep)
    • fieldCollectionToConstant

      protected String fieldCollectionToConstant(Collection<UMod.FieldDef> coll, String sep)
    • addDocumentation

      protected void addDocumentation(GeneratedAnnotationTarget target, @Opt UMod.Item source, @Opt @Opt String genericAlternative, @Opt @Opt String concludingText)
      Adds metajava documentation objects to the generated metajava structure. Calls addDocumentation(GeneratedAnnotationTarget, UMod.INTERFACE, String, String, String) with prefixToUser==null.
    • addDocumentation

      protected void addDocumentation(GeneratedAnnotationTarget target, @Opt UMod.Item source, @Opt @Opt String prefixToUser, @Opt @Opt String genericAlternative, @Opt @Opt String concludingText)
      Adds metajava documentation objects to the generated metajava structure. Documentation is added iff umod runs in doc-mode. Doc-mode is enabled iff there is at least one DOC entry in the umod source.

      The generated documentation consists of:

      • The explicit documentation text from the umod source connected to item source, if the item is not null and there is such text. The documentation text is the concatenation of all DOC entries in the source, in source order. It shall adhere to the javadoc rules; esp. the first sentence should be self-contained and end with ". " = period and space. This text is included in <div class="bandmUser"> and prefixed by prefixToUser, if not null.
      • Otherwise the text in genericAlternative, if not null.
      • Followed by a textual and linked source indication, if item != null.
      • Followed by concludingText, if not null.
      Parameters:
      target - the generated metajava object to be documented.
      source - the umod source which led to the generation, or null.
      genericAlternative - text which is used if there is no doc-text in the the umod source related to the item given by source; may be null.
      concludingText - text appended to the end of the doc text. Only this text may contain @see, @param and @return tags. The contents of these are not HTML, but plain text only.
    • addDocumentation

      protected void addDocumentation(GeneratedAnnotationTarget target, String text)
      Add comment text, but only iff we run in doc mode.
    • ERROR

      protected void ERROR(Locatable<XMLDocumentIdentifier> loc, String txt)
    • WARNING

      protected void WARNING(Locatable<XMLDocumentIdentifier> loc, String txt)
    • WARNING

      protected void WARNING(String txt)
    • logS

      protected void logS(String txt)
    • logE

      protected void logE(String txt)
    • logE

      protected void logE()
    • checkErrors

      protected void checkErrors()
    • translate

      public GeneratedPackage translate(UMod.Forest code, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg0, String pkgname, Format generationDescription, boolean getterfunctions, boolean setterfunctions, boolean make_patterns, boolean saxgen, boolean swingtreegen, boolean visitordebug, boolean visitoroptimize, boolean visitorcompile, boolean allrewriterwarnings, boolean monolithic, boolean floatNotDouble, boolean constructorsPre20181214)
      Main class for translating a UMod model into Java source code. It is alled with an UMod.Forest object, which (nearly always) comes from a Reducer, which translates some umod source file. It outputs a GeneratedPackage, which can be written to a source text file as usual.

      This main method calls additionally the main methods in the separate classes UMod2visitors, UMod2Tsoap and UMod2format.
      The sub-workes defined LOVALLY here are Visitors, namely UMod2java.ExtInstantier. UMod2java.V_compileVerbatimJava. UMod2java.V_importFieldTypes, UMod2java.V_compileFieldDefs, UMod2java.V__compileSwingTree, UMod2java.V_compileAlgebraic, UMod2java.V_compileOrdered, UMod2java.V_initFrom.
      Additionally, the class Types is used for type algebraics, and mapping UMod types to Java types.
    • resolveExternals

      protected void resolveExternals(UMod.Forest forest)
      <!ELEMENT extinstantiation (absoluteref, extinstantiation*) >
    • resolveOneExternal

      protected void resolveOneExternal(UMod.ExtDeclaration ext)
    • compileEnumDef

      protected void compileEnumDef(UMod.EnumDef td, GeneratedContext context)
      An UMod.EnumDef is a simple UMod expression which is translated to a java enumeration type. FIXME MISSING embedded java with enum or enum item currently not supported by input grammar.
    • compileIfaceDef

      protected void compileIfaceDef(UMod.IfaceDef td, GeneratedContext context)
      An UMod INTERFACE A | B || C construct is a lean notation which is translated into the definition of new java interfaces in the generated context (package or class). (Do not mix up with IMPLEMENTS!) FIXME currently documentation text is not supported.
    • compileTypeDef

      protected void compileTypeDef(UMod.TypeDef td, GeneratedContext context)
      FIXME assert that type expression is COMPLEX (not just T_reference or primitive!) Typedefs are CURRENTLY NOT YET USED NOR TESTED !
    • makeTConstructor

      protected void makeTConstructor(GeneratedClass gc, MetaType[] args)
    • addIfaceDeclarations

      protected void addIfaceDeclarations(UMod.Forest forest)
    • compilePatterns

      protected void compilePatterns(GeneratedContext context)
    • compilePatterns

      protected void compilePatterns(UMod.ClassDef cd)
    • makePrivate0aryConstructors

      protected void makePrivate0aryConstructors(boolean monolithicMode)
    • makeswingtree

      protected void makeswingtree(UMod.Forest forest, GeneratedContext context, GeneratedClass basematcher, boolean visitoroptimize)