public class UMod2java extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UMod2java.AbortExecution |
protected class |
UMod2java.CompileConstructors |
protected class |
UMod2java.CompileConstructors_20181214 |
protected class |
UMod2java.ExtInstantier |
protected class |
UMod2java.V__compileSwingTree |
protected class |
UMod2java.V_compileAlgebraic
Every method ".equals" and ".hashCode" does process all fields of all superclasses,
without delegation.
|
protected class |
UMod2java.V_compileClassDefs |
protected class |
UMod2java.V_compileFieldDefs |
protected class |
UMod2java.V_compileOrdered |
protected class |
UMod2java.V_compileVerbatimJava |
protected class |
UMod2java.V_importFieldTypes |
protected class |
UMod2java.V_initFrom |
Modifier and Type | Field and Description |
---|---|
static GeneratedAnnotation |
annotationDeprecated |
protected GeneratedClass |
class_term_patterns |
String |
CLASSNAME_TERM_PATTERNS |
static String |
CLASSNAME_TREEGEN |
static String |
comment_link_to_prettyPrint |
protected UMod.Forest |
curforest
GLO variable for the resolution of identifiers (local or exernal)
|
static String |
DOC_SEP |
static String |
docDefault
First sentence of default documentation text for generated entities which do not
allow user doc.
|
static String |
docMissing
First sentence of default documentation text for classes and fields.
|
static String |
docMissing_x |
static Format |
doubleColonComment |
protected static Format |
dueToAlg |
static Format |
F_DOC_SEP |
protected boolean |
floatNotDouble |
protected static Format |
FORMAT_null |
protected boolean |
hasUserDoc |
protected Types.HtmlDocText |
htmlDocText
Visitor which delivers a HTML representation of a umod type.
|
protected String |
htmlPPfilename |
protected String |
log_phase |
protected static String |
METHODNAME_GETFORMATHINT |
protected static int |
MODIF_CALLABLE |
protected static int |
MODIF_PACKAGE_ACCESSIBLE |
protected static int |
MODIF_STATIC_CONST |
protected static int |
MODIF_STATICCALLABLE |
protected static int |
MODIF_STATICCLASS |
protected static int |
MODIF_STATICFIELD |
protected static int |
MODIF_STATICFINALFIELD |
protected static int |
MODIF_TOPCLASS |
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> |
msg |
protected MessageCounter<SimpleMessage<XMLDocumentIdentifier>> |
msgCounter |
protected static String |
NAME_SAX_PARSER |
protected static String |
NAME_SAX_WRITER |
String |
NAMESTUB_PATTERN_CAST |
String |
NAMESTUB_PATTERN_TERM |
static String |
suffix_srcDoc |
static ClassLoader |
targetClassLoader
Only used for "EXT" declarations, not for implicit use of "java.util.*"
|
protected int |
userDocLevel |
protected static MetaClass |
WRAPPEDCLASS_swing_tree_TreeNode |
protected static MetaClass |
WRAPPEDCLASS_SwingForester |
protected static MetaClass |
WRAPPEDCLASS_SwingForester_LazyNode |
Constructor and Description |
---|
UMod2java() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDocumentation(GeneratedAnnotationTarget target,
String text)
Add comment text, but only iff we run in doc mode.
|
protected void |
addDocumentation(GeneratedAnnotationTarget target,
UMod.Item source,
@Opt String genericAlternative,
@Opt String concludingText)
Adds metajava documentation objects to the generated metajava structure.
|
protected void |
addDocumentation(GeneratedAnnotationTarget target,
UMod.Item source,
@Opt String prefixToUser,
@Opt String genericAlternative,
@Opt String concludingText)
Adds metajava documentation objects to the generated metajava structure.
|
protected void |
addIfaceDeclarations(UMod.Forest forest) |
static String |
canonicalFieldName(UMod.FieldDef fd) |
protected void |
checkErrors() |
protected void |
compileEnumDef(UMod.EnumDef td,
GeneratedContext context)
An
UMod.EnumDef is a simple UMod expression which is translated to a
java enumeration type. |
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). |
protected void |
compilePatterns(GeneratedContext context) |
protected void |
compilePatterns(UMod.ClassDef cd) |
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 !
|
protected void |
ERROR(Locatable<XMLDocumentIdentifier> loc,
String txt) |
protected String |
fieldCollectionToConstant(Collection<UMod.FieldDef> coll,
String sep) |
protected String |
fieldSetToString(Collection<UMod.FieldDef> coll,
String sep) |
protected static Class |
findexternalclassforname(String n)
Only used for "EXT" declarations, not for implicit use of "java.util.*".
|
protected void |
logE() |
protected void |
logE(String txt) |
protected void |
logS(String txt) |
protected void |
makePrivate0aryConstructors(boolean monolithicMode) |
protected void |
makeswingtree(UMod.Forest forest,
GeneratedContext context,
GeneratedClass basematcher,
boolean visitoroptimize) |
protected void |
makeTConstructor(GeneratedClass gc,
MetaType[] args) |
protected void |
resolveExternals(UMod.Forest forest)
<!ELEMENT extinstantiation (absoluteref, extinstantiation*) > |
protected void |
resolveOneExternal(UMod.ExtDeclaration ext) |
protected static Format |
strictnessCheck(UMod.FieldDef fd) |
static int |
toplevelModif(GeneratedContext context)
If context is not a GeneratedClass, then it is a GeneratedPACKAGE
and "static" is not allowed!
|
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 allrewriterwarnings,
boolean monolithic,
boolean floatNotDouble,
boolean constructorsPre20181214)
Main class for translating a UMod model into Java source code.
|
protected void |
WARNING(Locatable<XMLDocumentIdentifier> loc,
String txt) |
protected void |
WARNING(String txt) |
public static final ClassLoader targetClassLoader
public static final String DOC_SEP
public static final Format F_DOC_SEP
public static final String docMissing_x
public static final String docMissing
public static final String docDefault
INTERFACE
signatures defined in umod.protected static final Format FORMAT_null
protected static final String NAME_SAX_PARSER
protected static final String NAME_SAX_WRITER
protected static final String METHODNAME_GETFORMATHINT
public static final String CLASSNAME_TREEGEN
protected static final int MODIF_PACKAGE_ACCESSIBLE
protected static final int MODIF_TOPCLASS
protected static final int MODIF_STATICCLASS
protected static final int MODIF_STATIC_CONST
protected static final int MODIF_STATICFIELD
protected static final int MODIF_STATICFINALFIELD
protected static final int MODIF_CALLABLE
protected static final int MODIF_STATICCALLABLE
public static final String suffix_srcDoc
public static final String comment_link_to_prettyPrint
protected UMod.Forest curforest
protected boolean floatNotDouble
protected int userDocLevel
protected boolean hasUserDoc
protected Types.HtmlDocText htmlDocText
protected String htmlPPfilename
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg
protected MessageCounter<SimpleMessage<XMLDocumentIdentifier>> msgCounter
protected String log_phase
public static final GeneratedAnnotation annotationDeprecated
public static final Format doubleColonComment
public final String CLASSNAME_TERM_PATTERNS
public final String NAMESTUB_PATTERN_TERM
public final String NAMESTUB_PATTERN_CAST
protected GeneratedClass class_term_patterns
protected static final MetaClass WRAPPEDCLASS_SwingForester
protected static final MetaClass WRAPPEDCLASS_SwingForester_LazyNode
protected static final MetaClass WRAPPEDCLASS_swing_tree_TreeNode
protected static final Format dueToAlg
protected static Class findexternalclassforname(String n)
public static String canonicalFieldName(UMod.FieldDef fd)
protected static Format strictnessCheck(UMod.FieldDef fd)
protected String fieldSetToString(Collection<UMod.FieldDef> coll, String sep)
protected String fieldCollectionToConstant(Collection<UMod.FieldDef> coll, String sep)
protected void addDocumentation(GeneratedAnnotationTarget target, @Opt UMod.Item source, @Opt @Opt String genericAlternative, @Opt @Opt String concludingText)
#addDocumentation(GeneratedAnnotationTarget, UMod.INTERFACE, String, String, String)
with prefixToUser==null
.protected void addDocumentation(GeneratedAnnotationTarget target, @Opt UMod.Item source, @Opt @Opt String prefixToUser, @Opt @Opt String genericAlternative, @Opt @Opt String concludingText)
DOC
entry in the umod source.
The generated documentation consists of:
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
.
generic alternative
, if not null
.
item != null
.
null
.
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.protected void addDocumentation(GeneratedAnnotationTarget target, String text)
protected void ERROR(Locatable<XMLDocumentIdentifier> loc, String txt)
protected void WARNING(Locatable<XMLDocumentIdentifier> loc, String txt)
protected void WARNING(String txt)
protected void logS(String txt)
protected void logE(String txt)
protected void logE()
protected void checkErrors()
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 allrewriterwarnings, boolean monolithic, boolean floatNotDouble, boolean constructorsPre20181214)
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.
UMod2visitors
, UMod2Tsoap
and UMod2format
.
UMod2java.ExtInstantier
.
UMod2java.V_compileVerbatimJava
.
UMod2java.V_importFieldTypes
,
UMod2java.V_compileFieldDefs
,
UMod2java.V__compileSwingTree
,
UMod2java.V_compileAlgebraic
,
UMod2java.V_compileOrdered
,
UMod2java.V_initFrom
.
Types
is used for type algebraics, and mapping
UMod types to Java types.protected void resolveExternals(UMod.Forest forest)
<!ELEMENT extinstantiation (absoluteref, extinstantiation*) >
protected void resolveOneExternal(UMod.ExtDeclaration ext)
public static int toplevelModif(GeneratedContext context)
protected void compileEnumDef(UMod.EnumDef td, GeneratedContext context)
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.protected void compileIfaceDef(UMod.IfaceDef td, GeneratedContext context)
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.protected void compileTypeDef(UMod.TypeDef td, GeneratedContext context)
protected void makeTConstructor(GeneratedClass gc, MetaType[] args)
protected void addIfaceDeclarations(UMod.Forest forest)
protected void compilePatterns(GeneratedContext context)
protected void compilePatterns(UMod.ClassDef cd)
protected void makePrivate0aryConstructors(boolean monolithicMode)
protected void makeswingtree(UMod.Forest forest, GeneratedContext context, GeneratedClass basematcher, boolean visitoroptimize)
see also the complete user documentation .