Package eu.bandm.tools.umod
Class UMod2java
java.lang.Object
eu.bandm.tools.umod.UMod2java
@PropertyDependency("eu.bandm.tools.umod.UMod2java.targetClassPath")
public class UMod2java
extends Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprotected classprotected classprotected classprotected classprotected classEvery method ".equals" and ".hashCode" does process all fields of all superclasses, without delegation.protected classprotected classprotected classprotected classprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Formatprotected GeneratedClassfinal Stringstatic final Stringstatic final Stringprotected UMod.ForestGlobal variable for the resolution of identifiers (local or exernal)static final StringHtml element to separate the sections of one Java api doc entry.static final StringFirst sentence of default documentation text for generated entities which cannot have an explicit »DOC« entry in the umod syntax.static final StringFirst sentence of the default documentation text for classes and fields, when doc by the author is missing.static final StringText for all model elements for which an explicit user doc by the model author is missing.static final Formatprotected static final Formatstatic final FormatHtml element to separate the sections of one Java api doc entry.protected booleanWhether to use Java float and not Java double for the realisation of the umod »float« type.protected static final Formatprotected GeneratedAnnotationprotected booleanWhether API doc will be inserted into the generated source.protected Types.HtmlDocTextVisitor which delivers a HTML representation of a umod type.protected StringThe name of the pretty-printed and navigable source text.protected Stringstatic final Stringprotected static final Stringstatic final Stringprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> protected MessageCounterprotected static final Stringprotected static final Stringfinal Stringfinal Stringstatic final Stringstatic final ClassLoaderClassloader for the resolution ofEXT...declarations.protected intprotected static final MetaClassprotected static final MetaClassprotected static final MetaClass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDocumentation(GeneratedAnnotationTarget target, UMod.Item source, @Opt String genericAlternative, @Opt String concludingText) protected voidaddDocumentation(GeneratedAnnotationTarget target, UMod.Item source, @Opt String prefixToUser, @Opt String genericAlternative, @Opt String concludingText) Adds metajava documentation objects to the generated metajava structure.protected voidaddDocumentation(GeneratedAnnotationTarget target, String text) Add comment text, but only iff we run in doc mode.protected voidaddIfaceDeclarations(UMod.Forest forest) protected voidTerminate the execution if an error or a failure has been signalled.protected voidcompileEnumDef(UMod.EnumDef td, GeneratedContext context) AnUMod.EnumDefis a simple UMod expression which is translated to a java enumeration type.protected voidcompileIfaceDef(UMod.IfaceDef td, GeneratedContext context) A UModINTERFACE A | B || Cexpression is a lean notation which is translated into the definition of new java interfaces in the generated context (package or class).protected voidcompilePatterns(GeneratedContext context) protected voidprotected voidcompileTypeDef(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 !protected voidERROR(Locatable<XMLDocumentIdentifier> loc, String txt) protected StringfieldCollectionToConstant(Collection<UMod.FieldDef> coll, String sep) protected StringfieldSetToString(Collection<UMod.FieldDef> coll, String sep) Resolution ofEXT...declarations.protected voidlogE()protected voidprotected voidprotected voidmakePrivate0aryConstructors(boolean monolithicMode) protected voidmakeswingtree(UMod.Forest forest, GeneratedClass modelclass, GeneratedContext context, GeneratedClass basematcher, boolean visitoroptimize) Generate a lazy Java swing representation for all models of this meta-model.protected voidmakeTConstructor(GeneratedClass gc, MetaType[] args) protected voidresolveExternals(UMod.Forest forest) <!ELEMENT extinstantiation (absoluteref, extinstantiation*) >protected voidprotected static FormatReturn a format which reads the field value with a non-null check.translate(UMod.Forest code, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg0, String pkgname, Format generationDescription, String dateAndTime, 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.protected voidWARNING(Locatable<XMLDocumentIdentifier> loc, String txt) protected void
-
Field Details
-
targetClassLoader
Classloader for the resolution ofEXT...declarations. (Is not used for the resolution of the defaultjava.util.*classes.) -
DOC_SEP
Html element to separate the sections of one Java api doc entry.- See Also:
-
F_DOC_SEP
Html element to separate the sections of one Java api doc entry. -
docMissing_x
Text for all model elements for which an explicit user doc by the model author is missing. (The trailing blank supports the recognition of the closing full-stop.)- See Also:
-
docMissing
First sentence of the default documentation text for classes and fields, when doc by the author is missing.- See Also:
-
docDefault
First sentence of default documentation text for generated entities which cannot have an explicit »DOC« entry in the umod syntax. Currently these are only theINTERFACEsignatures defined in umod. (The trailing blank supports the recognition of the closing full-stop.)- See Also:
-
FORMAT_null
-
NAME_SAX_PARSER
- See Also:
-
NAME_SAX_WRITER
- See Also:
-
METHODNAME_GETFORMATHINT
- See Also:
-
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
- See Also:
-
comment_link_to_prettyPrint
- See Also:
-
curforest
Global variable for the resolution of identifiers (local or exernal) -
floatNotDouble
protected boolean floatNotDoubleWhether to use Java float and not Java double for the realisation of the umod »float« type. -
userDocLevel
protected int userDocLevel -
hasUserDoc
protected boolean hasUserDocWhether API doc will be inserted into the generated source. This depends from at least »DOC« entry appearing in the umod source text. -
htmlDocText
Visitor which delivers a HTML representation of a umod type. This includes navigation links for reference types, etc. -
htmlPPfilename
The name of the pretty-printed and navigable source text. As part of the API-doc it is referred to ubiquituously. -
msg
-
msgCounter
-
log_phase
-
annotationGeneratedArguments
-
generationAnnotation
-
doubleColonComment
-
CLASSNAME_TERM_PATTERNS
- See Also:
-
NAMESTUB_PATTERN_TERM
- See Also:
-
NAMESTUB_PATTERN_CAST
- See Also:
-
class_term_patterns
-
METHODNAME_FORESTER_ENTRYPOINT
- See Also:
-
METHODNAME_TOSWINGTREE
- See Also:
-
WRAPPEDCLASS_SwingForester
-
WRAPPEDCLASS_SwingForester_LazyNode
-
WRAPPEDCLASS_swing_tree_TreeNode
-
dueToAlg
-
-
Constructor Details
-
UMod2java
public UMod2java()
-
-
Method Details
-
findexternalclassforname
Resolution ofEXT...declarations. ATTENTION: Operates heuristically: replaces ».« by »$« to find inner classes. (Is not used for the resolution of the defaultjava.util.*classes.)- Parameters:
n- the qualified name of the external calls to import.- Returns:
- the found class, or null.
-
strictnessCheck
Return a format which reads the field value with a non-null check.- Parameters:
fd- the field to read- Returns:
- a format which reads the field value with a non-null check.
-
fieldSetToString
-
fieldCollectionToConstant
-
addDocumentation
-
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 if and only if umod runs in doc-mode, seehasUserDoc. Doc-mode is enabled iff there is at least oneDOCentry in the umod source.The generated documentation consists of:
- The explicit documentation text from the umod source connected
to umod item
source, if the item is!=nulland there is such text. The documentation text is the concatenation of allDOCentries 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 byprefixToUser, if that is not==null. - Otherwise the text in
genericAlternative, if that is!=null. - Followed by the
concludingText, if!=null. - Up to here only the prefixes of these texts are included, up to the start of the first javadoc "block tag".
- Followed by a textual and linked source indication, if
item != null. - Then follow the suffices of the selected texts, starting with the first javadoc "block tag".
See this technical article.
- Parameters:
target- the generated metajava object to be documented.source- the umod source which led to the generation, ornull. FIXME DOCME wann ist das null ?prefixToUser- inserted before the author-defined doc text.genericAlternative- text which is used if there is no doc-text in the the umod source related to the item given bysource; may be==null.concludingText- to be put behind the author's or default text, anyhow.
- The explicit documentation text from the umod source connected
to umod item
-
addDocumentation
Add comment text, but only iff we run in doc mode. -
ERROR
-
WARNING
-
WARNING
-
logS
-
logE
-
logE
protected void logE() -
checkErrors
protected void checkErrors()Terminate the execution if an error or a failure has been signalled. Sends a notifiying message and throws an exception.- Throws:
UMod2java.AbortExecution
-
translate
public GeneratedPackage translate(UMod.Forest code, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg0, String pkgname, Format generationDescription, String dateAndTime, 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 anUMod.Forestobject, which corresponds to some umod source file or has been constructed purely programmatically. It outputs aGeneratedPackage, which can be written to a source text file as usual.This main method calls additionally the main methods in separate classes
UMod2visitors,UMod2Tsoap,UMod2format, etc.The sub-workes defined locally 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 classTypesis used for type algebraics, and mapping UMod types to Java types. -
resolveExternals
<!ELEMENT extinstantiation (absoluteref, extinstantiation*) > -
resolveOneExternal
-
compileEnumDef
AnUMod.EnumDefis 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
A UModINTERFACE A | B || Cexpression is a lean notation which is translated into the definition of new java interfaces in the generated context (package or class). (Not to be mixed up with »IMPLEMENTS«.) FIXME currently documentation text is not supported. -
compileTypeDef
FIXME assert that type expression is COMPLEX (not just T_reference or primitive!) Typedefs are CURRENTLY NOT YET USED NOR TESTED ! -
makeTConstructor
-
addIfaceDeclarations
-
compilePatterns
-
compilePatterns
-
makePrivate0aryConstructors
protected void makePrivate0aryConstructors(boolean monolithicMode) -
makeswingtree
protected void makeswingtree(UMod.Forest forest, GeneratedClass modelclass, GeneratedContext context, GeneratedClass basematcher, boolean visitoroptimize) Generate a lazy Java swing representation for all models of this meta-model. The activation goes via the model class, as inutil.ui.SwingBrowser.displayTree ([modelclass].toSwingTree([modelelement]) ;
-