public class Factory extends Object
GeneratedPackage gp = new UMod2Java().translate(...)
new Unparser.write(gp)
model
.
The umod model classes defined in UMod
are returned as results and
accessible via model
and can be manipulated directly, if required.
But the factory methods are preferred, because of implied consistency.
parserLike
is set to true:
Modifier and Type | Class and Description |
---|---|
static class |
Factory.VisitorFlavours
A convenience wrapper for the different combinations of boolean attributes
of visitor definitions.
|
Modifier and Type | Field and Description |
---|---|
UMod.Forest |
model |
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> |
msg |
boolean |
parserLike |
Constructor and Description |
---|
Factory(String name,
boolean parserLike,
@Opt Location<XMLDocumentIdentifier> loc,
@Opt String doc) |
Modifier and Type | Method and Description |
---|---|
UMod.ClassDef |
addClassDef(UMod.ClassDef superclass,
String name,
@Opt Location<XMLDocumentIdentifier> loc,
@Opt String doc,
boolean isAlgebraic,
boolean isAbstract)
Add a class definition to the model.
|
void |
addDocumentation(UMod.Item item,
String text)
Append a String to the documentation sequence of the model itself,
a Class/Enumeration/Visitor/Interface definition, or a Field definition.
|
UMod.EnumDef |
addEnumDef(String name,
@Opt Location<XMLDocumentIdentifier> loc,
@Opt String doc)
Add an enumeration definition to the model.
|
UMod.EnumDef |
addEnumDef(String name,
@Opt Location<XMLDocumentIdentifier> loc,
@Opt String doc,
String... items)
Add an enumeration definition plus some/all of its enumeration values to the model.
|
void |
addEnumItem(UMod.EnumDef edef,
String name,
@Opt String doc)
Add a further enumeration value to an already defined enumeration type.
|
UMod.ExtDeclaration |
addExternalDeclaration(String name,
@Opt Location<XMLDocumentIdentifier> loc)
Add an external declaration to the model.
|
UMod.FieldDef |
addFieldDef(UMod.ClassDef cls,
String name,
UMod.Type fieldType,
@Opt Location<XMLDocumentIdentifier> loc,
@Opt String doc)
Add a field definition to a class definition.
|
void |
addJavaText(UMod.ClassDef cd,
String text,
@Opt Location<XMLDocumentIdentifier> loc)
Add a verbatim java block, either to a class definition's code, or to the
top-level model classs, if
cd==null . |
void |
addTostringText(UMod.ClassDef cd,
String text,
@Opt Location<XMLDocumentIdentifier> loc)
Add a standard
toString() method to the class definition's code. |
UMod.VisitorHint |
addVisitorDef(String name,
@Opt Location<XMLDocumentIdentifier> loc,
@Opt String doc,
@Opt Factory.VisitorFlavours flavour,
int number)
Add a base visitor definition to the model.
|
protected void |
opt_addDocumentation(UMod.Item item,
@Opt String text) |
protected void |
putDef(UMod.Item it,
String name)
Add definition into the one, unified toplevel namespace.
|
void |
setDocumentation(UMod.EnumDef def,
String item,
String text)
Put the string value as (the only!) doc text of the enumeration item.
|
protected void |
synterror(Location<XMLDocumentIdentifier> loc,
String txt) |
public final UMod.Forest model
public final boolean parserLike
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg
protected void putDef(UMod.Item it, String name)
protected void synterror(Location<XMLDocumentIdentifier> loc, String txt)
public void addDocumentation(UMod.Item item, String text)
public void setDocumentation(UMod.EnumDef def, String item, String text)
public UMod.ExtDeclaration addExternalDeclaration(String name, @Opt @Opt Location<XMLDocumentIdentifier> loc)
public UMod.VisitorHint addVisitorDef(String name, @Opt @Opt Location<XMLDocumentIdentifier> loc, @Opt @Opt String doc, @Opt @Opt Factory.VisitorFlavours flavour, int number)
public UMod.EnumDef addEnumDef(String name, @Opt @Opt Location<XMLDocumentIdentifier> loc, @Opt @Opt String doc)
public UMod.EnumDef addEnumDef(String name, @Opt @Opt Location<XMLDocumentIdentifier> loc, @Opt @Opt String doc, String... items)
public void addEnumItem(UMod.EnumDef edef, String name, @Opt @Opt String doc)
public UMod.ClassDef addClassDef(@Opt UMod.ClassDef superclass, String name, @Opt @Opt Location<XMLDocumentIdentifier> loc, @Opt @Opt String doc, boolean isAlgebraic, boolean isAbstract)
public void addJavaText(@Opt UMod.ClassDef cd, String text, @Opt @Opt Location<XMLDocumentIdentifier> loc)
cd==null
.public void addTostringText(UMod.ClassDef cd, String text, @Opt @Opt Location<XMLDocumentIdentifier> loc)
toString()
method to the class definition's code.public UMod.FieldDef addFieldDef(UMod.ClassDef cls, String name, UMod.Type fieldType, @Opt @Opt Location<XMLDocumentIdentifier> loc, @Opt @Opt String doc)
Checker
.
The type of the field can be constructed by the constructors of the
sub-classes of UMod.TypeConstructed
, applied recursively, and to the constants
UMod.BOOL
, UMod.CHAR
, UMod.FLOAT
, UMod.INT
and UMod.STRING
.
Reducer.predefinedTypes
.see also the complete user documentation .