umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
#include <javawriter.h>
Public Member Functions | |
JavaWriter () | |
virtual | ~JavaWriter () |
virtual void | writeClass (UMLClassifier *c) |
virtual Uml::ProgrammingLanguage::Enum | language () const |
QStringList | defaultDatatypes () const |
Public Member Functions inherited from SimpleCodeGenerator | |
SimpleCodeGenerator (bool createDirHierarchyForPackages=true) | |
virtual | ~SimpleCodeGenerator () |
void | writeCodeToFile (UMLClassifierList &concepts) |
void | writeCodeToFile () |
Public Member Functions inherited from CodeGenerator | |
CodeGenerator () | |
virtual | ~CodeGenerator () |
bool | addCodeDocument (CodeDocument *add_object) |
bool | removeCodeDocument (CodeDocument *remove_object) |
CodeDocumentList * | getCodeDocumentList () |
QString | getUniqueID (CodeDocument *codeDoc) |
virtual void | saveToXMI (QXmlStreamWriter &writer) |
CodeDocument * | findCodeDocumentByID (const QString &id) |
void | setIncludeHeadings (bool i) |
bool | includeHeadings () const |
void | setHeadingFileDir (const QString &) |
QString | headingFileDir () const |
void | setForceDoc (bool f) |
bool | forceDoc () const |
void | setForceSections (bool f) |
bool | forceSections () const |
virtual QString | getHeadingFile (const QString &file) |
QString | findFileName (CodeDocument *codeDocument) |
virtual void | loadFromXMI (QDomElement &element) |
CodeDocument * | findCodeDocumentByClassifier (UMLClassifier *classifier) |
virtual bool | isReservedKeyword (const QString &keyword) |
virtual QStringList | reservedKeywords () const |
virtual void | createDefaultStereotypes () |
Private Member Functions | |
void | writeClassDecl (UMLClassifier *c, QTextStream &java) |
void | writeConstructor (UMLClassifier *c, QTextStream &java) |
void | getSuperImplementedOperations (UMLClassifier *c, UMLOperationList &yetImplementedOpList, UMLOperationList &toBeImplementedOpList, bool noClassInPath=true) |
void | getInterfacesOperationsToBeImplemented (UMLClassifier *c, UMLOperationList &opl) |
void | writeOperations (UMLClassifier *c, QTextStream &j) |
void | writeOperations (UMLOperationList &oplist, QTextStream &j) |
void | writeAttributeDecls (UMLAttributeList &atpub, UMLAttributeList &atprot, UMLAttributeList &atpriv, QTextStream &java) |
void | writeAssociationDecls (UMLAssociationList associations, Uml::ID::Type id, QTextStream &java) |
void | writeAssociationRoleDecl (QString fieldClassName, QString roleName, QString multi, QString doc, Uml::Visibility::Enum visib, QTextStream &java) |
void | writeAttributeMethods (UMLAttributeList &atpub, Uml::Visibility::Enum visibility, QTextStream &java) |
void | writeAssociationMethods (UMLAssociationList associations, UMLClassifier *thisClass, QTextStream &java) |
void | writeAssociationRoleMethod (QString fieldClassName, QString roleName, QString multi, QString description, Uml::Visibility::Enum visib, Uml::Changeability::Enum change, QTextStream &java) |
void | writeSingleAttributeAccessorMethods (QString fieldClassName, QString fieldVarName, QString fieldName, QString description, Uml::Visibility::Enum visibility, Uml::Changeability::Enum change, bool isFinal, QTextStream &java) |
void | writeVectorAttributeAccessorMethods (QString fieldClassName, QString fieldVarName, QString fieldName, QString description, Uml::Visibility::Enum visibility, Uml::Changeability::Enum change, QTextStream &java) |
void | writeComment (const QString &text, const QString &indent, QTextStream &java, bool javaDocStyle=false) |
void | writeDocumentation (QString header, QString body, QString end, QString indent, QTextStream &java) |
QString | getUMLObjectName (UMLObject *obj) |
QString | fixTypeName (const QString &string) |
QString | fixInitialStringDeclValue (const QString &val, const QString &type) |
void | writeBlankLine (QTextStream &java) |
Static Private Member Functions | |
static bool | compareJavaMethod (UMLOperation *op1, UMLOperation *op2) |
static bool | javaMethodInList (UMLOperation *umlOp, UMLOperationList &opl) |
Private Attributes | |
QString | m_startline |
a , used at the end of each line More... | |
bool | m_isInterface |
whether or not this concept is an interface More... | |
Additional Inherited Members | |
Public Types inherited from CodeGenerator | |
enum | GenerationState { Generated , Failed , Skipped } |
Public Slots inherited from SimpleCodeGenerator | |
virtual void | syncCodeToDocument () |
Public Slots inherited from CodeGenerator | |
virtual void | syncCodeToDocument () |
Signals inherited from CodeGenerator | |
void | codeGenerated (UMLClassifier *concept, bool generated) |
void | codeGenerated (UMLClassifier *concept, CodeGenerator::GenerationState result) |
void | showGeneratedFile (const QString &filename) |
Static Public Member Functions inherited from CodeGenerator | |
static QString | cleanName (const QString &name) |
static QString | formatDoc (const QString &text, const QString &linePrefix=QLatin1String(" *"), int lineWidth=80) |
static QString | formatSourceCode (const QString &code, const QString &indentation) |
static void | findObjectsRelated (UMLClassifier *c, UMLPackageList &cList) |
Protected Member Functions inherited from SimpleCodeGenerator | |
QString | findFileName (UMLPackage *concept, const QString &ext) |
QString | overwritableName (UMLPackage *concept, const QString &name, const QString &ext) |
bool | hasDefaultValueAttr (UMLClassifier *c) |
bool | hasAbstractOps (UMLClassifier *c) |
QString | indent () |
virtual void | initFromParentDocument () |
Protected Member Functions inherited from CodeGenerator | |
QString | overwritableName (const QString &name, const QString &extension) |
bool | openFile (QFile &file, const QString &name) |
void | writeListedCodeDocsToFile (CodeDocumentList *docs) |
virtual void | finalizeRun () |
Protected Attributes inherited from SimpleCodeGenerator | |
QString | className_ |
QString | fileName_ |
QMap< UMLPackage *, QString > | m_fileMap |
bool | m_createDirHierarchyForPackages |
QString | m_indentation |
int | m_indentLevel |
QString | m_endl |
Protected Attributes inherited from CodeGenerator | |
QHash< QString, CodeDocument * > | m_codeDocumentDictionary |
bool | m_applyToAllRemaining |
UMLDoc * | m_document |
Class JavaWriter is a code generator for UMLClassifier objects. Create an instance of this class, and feed it a UMLClassifier when calling writeClass and it will generate a java source file for that concept. This is the "old" code generator that does not support code editing in the Modeller but uses significantly less file space because the source code is not replicated in the XMI file.
JavaWriter::JavaWriter | ( | ) |
Constructor, initialises a couple of variables.
|
virtual |
Destructor, empty.
|
staticprivate |
Return true if the two operations have the same name and the same parameters.
op1 | first operation to be compared |
op2 | second operation to be compared |
|
virtual |
Overrides method from class CodeGenerator.
Reimplemented from CodeGenerator.
|
private |
Check that initial values of strings have quotes around them.
|
private |
Replaces `string' with `String' and `bool' with `boolean'. IF the type is "string" we need to declare it as the Java Object "String" (there is no string primitive in Java). Same thing again for "bool" to "boolean".
|
private |
Get all operations which a given class inherit from all its super interfaces and that should be implemented.
c | the class for which we are generating code |
opList | the list of operations used to append the operations |
|
private |
Get all operations which a given class inherit from all its super interfaces and get all operations which this given class inherit from all its super classes.
c | the class for which we are generating code |
yetImplementedOpList | the list of yet implemented operations |
toBeImplementedOpList | the list of to be implemented operations |
noClassInPath | tells if there is a class between the base class and the current interface |
|
private |
Returns the name of the given object (if it exists).
|
staticprivate |
Return true if the operation is in the list.
umlOp | operation to be searched |
opl | list of operations |
|
virtual |
|
private |
Searches a list of associations for appropriate ones to write out as attributes.
|
private |
Calls writeAssociationRoleMethod() on each of the associations in the given list.
|
private |
Writes out an association as an attribute using Vector.
|
private |
Calls writeSingleAttributeAccessorMethods() or writeVectorAttributeAccessorMethods() on the association role.
|
private |
Writes the Attribute declarations.
atpub | list of public attributes |
atprot | list of protected attributes |
atpriv | list of private attributes |
java | text stream |
|
private |
Calls writeSingleAttributeAccessorMethods() on each of the attributes in atpub.
|
private |
Write a blank line. Note: Methods like this _shouldn't_ be needed IF we properly did things thruought the code.
|
virtual |
Call this method to generate java code for a UMLClassifier.
c | the class to generate code for |
Implements SimpleCodeGenerator.
|
private |
Writes class's documentation then the class header "public abstract class Foo extents {".
|
private |
Writes a // style comment.
|
private |
Writes the comment and class constructor.
|
private |
Writes a documentation comment.
|
private |
Write all operations for a given class.
c | the class for which we are generating code |
java | the stream associated with the output file |
|
private |
Write a list of operations for a given class.
oplist | the list of operations you want to write |
java | the stream associated with the output file |
|
private |
Writes getFoo() and setFoo() accessor methods for the attribute.
|
private |
Writes addFoo() and removeFoo() accessor methods for the Vector attribute.
|
private |
whether or not this concept is an interface
|
private |
a
, used at the end of each line