umbrello: umbrello/codegenerators/java/javawriter.h Source File

umbrello 2.32.1 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

javawriter.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2003 Brian Thomas *
8 * <brian.thomas@gsfc.nasa.gov> *
9 * copyright (C) 2004-2014 Umbrello UML Modeller Authors *
10 * <umbrello-devel@kde.org> *
11 ***************************************************************************/
12
13 #ifndef JAVAWRITER_H
14 #define JAVAWRITER_H
15
16 #include "simplecodegenerator.h"
17 #include "umloperationlist.h"
18 #include "umlattributelist.h"
19 #include "umlassociationlist.h"
20
21 class UMLOperation;
22
32 class JavaWriter : public SimpleCodeGenerator
33 {
34 public:
35 JavaWriter();
36 virtual ~JavaWriter();
37
38 virtual void writeClass(UMLClassifier *c);
39
40 virtual Uml::ProgrammingLanguage::Enum language() const;
41
42 QStringList defaultDatatypes();
43
44 private:
45 void writeClassDecl(UMLClassifier *c, QTextStream &java);
46
47 void writeConstructor(UMLClassifier *c, QTextStream &java);
48
49 static bool compareJavaMethod(UMLOperation *op1, UMLOperation *op2);
50
51 static bool javaMethodInList(UMLOperation *umlOp, UMLOperationList &opl);
52
53 void getSuperImplementedOperations(UMLClassifier *c, UMLOperationList &yetImplementedOpList, UMLOperationList &toBeImplementedOpList, bool noClassInPath = true);
54
55 void getInterfacesOperationsToBeImplemented(UMLClassifier *c, UMLOperationList &opl);
56
57 void writeOperations(UMLClassifier *c, QTextStream &j);
58
59 void writeOperations(UMLOperationList &list, QTextStream &j);
60
61 void writeAttributeDecls(UMLAttributeList &atpub, UMLAttributeList &atprot,
62 UMLAttributeList &atpriv, QTextStream &java);
63
64 void writeAssociationDecls(UMLAssociationList associations, Uml::ID::Type id, QTextStream &java);
65
66 void writeAssociationRoleDecl(QString fieldClassName, QString roleName, QString multi,
67 QString doc, Uml::Visibility::Enum visib, QTextStream &java);
68
69 void writeAttributeMethods(UMLAttributeList &atpub, Uml::Visibility::Enum visibility, QTextStream &java);
70
71 void writeAssociationMethods(UMLAssociationList associations, UMLClassifier *thisClass,
72 QTextStream &java);
73
74 void writeAssociationRoleMethod(QString fieldClassName, QString roleName, QString multi,
75 QString description, Uml::Visibility::Enum visib, Uml::Changeability::Enum change,
76 QTextStream &java);
77
78 void writeSingleAttributeAccessorMethods(QString fieldClassName, QString fieldVarName,
79 QString fieldName, QString description,
80 Uml::Visibility::Enum visibility, Uml::Changeability::Enum change,
81 bool isFinal, QTextStream &java);
82
83 void writeVectorAttributeAccessorMethods(QString fieldClassName, QString fieldVarName,
84 QString fieldName, QString description,
85 Uml::Visibility::Enum visibility, Uml::Changeability::Enum change,
86 QTextStream &java);
87
88 void writeComment(const QString &text, const QString &indent, QTextStream &java, bool javaDocStyle=false);
89
90 void writeDocumentation(QString header, QString body, QString end, QString indent, QTextStream &java);
91
92 QString getUMLObjectName(UMLObject *obj);
93
94 QString fixTypeName(const QString& string);
95
96 QString fixInitialStringDeclValue(const QString& val, const QString& type);
97
98 void writeBlankLine(QTextStream& java);
99
100 QString m_startline;
101 bool m_isInterface;
102
103 };
104
105 #endif // JAVAWRITER_H
UMLObject::package
QString package(const QString &separator=QString(), bool includeRoot=false)
Definition: umlobject.cpp:577
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
umlattributelist.h
JavaWriter::fixInitialStringDeclValue
QString fixInitialStringDeclValue(const QString &val, const QString &type)
Definition: javawriter.cpp:980
template.h
JavaWriter::~JavaWriter
virtual ~JavaWriter()
Definition: javawriter.cpp:43
UMLClassifier::getOpList
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0)
Definition: classifier.cpp:939
UMLClassifier::getUniAssociationToBeImplemented
virtual UMLAssociationList getUniAssociationToBeImplemented()
Definition: classifier.cpp:1325
UMLAttributeListIt
QListIterator< UMLAttribute * > UMLAttributeListIt
Definition: umlattributelist.h:20
JavaWriter::fixTypeName
QString fixTypeName(const QString &string)
Definition: javawriter.cpp:723
SimpleCodeGenerator::m_indentation
QString m_indentation
Definition: simplecodegenerator.h:76
javawriter.h
Uml::ProgrammingLanguage::Enum
Enum
Definition: basictypes.h:271
UMLClassifier::isInterface
bool isInterface() const
Definition: classifier.cpp:118
UMLAttributeList
Definition: umlattributelist.h:27
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
umloperationlist.h
CodeGenerator::getHeadingFile
virtual QString getHeadingFile(const QString &file)
Definition: codegenerator.cpp:407
UMLOperation::getParmList
UMLAttributeList getParmList() const
Definition: operation.cpp:178
UMLTemplate::getTypeName
virtual QString getTypeName() const
Definition: template.cpp:80
CodeGenerator::cleanName
static QString cleanName(const QString &name)
Definition: codegenerator.cpp:549
JavaWriter::defaultDatatypes
QStringList defaultDatatypes()
Definition: javawriter.cpp:738
Uml::Changeability::Changeable
@ Changeable
Definition: basictypes.h:205
JavaWriter::writeSingleAttributeAccessorMethods
void writeSingleAttributeAccessorMethods(QString fieldClassName, QString fieldVarName, QString fieldName, QString description, Uml::Visibility::Enum visibility, Uml::Changeability::Enum change, bool isFinal, QTextStream &java)
Definition: javawriter.cpp:674
JavaWriter::writeAssociationDecls
void writeAssociationDecls(UMLAssociationList associations, Uml::ID::Type id, QTextStream &java)
Definition: javawriter.cpp:492
Uml::ProgrammingLanguage::Java
@ Java
Definition: basictypes.h:278
operation.h
UMLAttribute::getInitialValue
QString getInitialValue() const
Definition: attribute.cpp:99
UMLClassifierListItem::getTypeName
virtual QString getTypeName() const
Definition: classifierlistitem.cpp:112
UMLClassifier::INTERFACE
@ INTERFACE
Definition: classifier.h:47
Uml::RoleType::A
@ A
Definition: basictypes.h:239
JavaWriter::getSuperImplementedOperations
void getSuperImplementedOperations(UMLClassifier *c, UMLOperationList &yetImplementedOpList, UMLOperationList &toBeImplementedOpList, bool noClassInPath=true)
Definition: javawriter.cpp:813
CodeGenerator::findObjectsRelated
static void findObjectsRelated(UMLClassifier *c, UMLPackageList &cList)
Definition: codegenerator.cpp:622
JavaWriter::JavaWriter
JavaWriter()
Definition: javawriter.cpp:34
JavaWriter::writeConstructor
void writeConstructor(UMLClassifier *c, QTextStream &java)
Definition: javawriter.cpp:702
JavaWriter::compareJavaMethod
static bool compareJavaMethod(UMLOperation *op1, UMLOperation *op2)
Definition: javawriter.cpp:768
association.h
UMLObject::isStatic
bool isStatic() const
Definition: umlobject.cpp:366
UMLClassifier::getTemplateList
UMLTemplateList getTemplateList() const
Definition: classifier.cpp:1148
Model_Utils::hasAssociations
bool hasAssociations(UMLObject::ObjectType type)
Definition: model_utils.cpp:2295
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
JavaWriter::writeClassDecl
void writeClassDecl(UMLClassifier *c, QTextStream &java)
Definition: javawriter.cpp:271
JavaWriter::m_startline
QString m_startline
a , used at the end of each line
Definition: javawriter.h:100
JavaWriter::getUMLObjectName
QString getUMLObjectName(UMLObject *obj)
Definition: javawriter.cpp:996
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
SimpleCodeGenerator::indent
QString indent()
Definition: simplecodegenerator.cpp:76
UMLObject::isAbstract
bool isAbstract() const
Definition: umlobject.cpp:348
JavaWriter::language
virtual Uml::ProgrammingLanguage::Enum language() const
Definition: javawriter.cpp:51
CodeGenerator::forceDoc
bool forceDoc() const
Definition: codegenerator.cpp:765
JavaWriter::m_isInterface
bool m_isInterface
whether or not this concept is an interface
Definition: javawriter.h:101
CodeGenerator::formatSourceCode
static QString formatSourceCode(const QString &code, const QString &indentation)
Definition: codegenerator.cpp:743
Uml::Changeability::Enum
Enum
Definition: basictypes.h:204
JavaWriter::getInterfacesOperationsToBeImplemented
void getInterfacesOperationsToBeImplemented(UMLClassifier *c, UMLOperationList &opl)
Definition: javawriter.cpp:841
Uml::Visibility::Public
@ Public
Definition: basictypes.h:60
Uml::Changeability::Frozen
@ Frozen
Definition: basictypes.h:206
Codegen_Utils::capitalizeFirstLetter
QString capitalizeFirstLetter(const QString &string)
Definition: codegen_utils.cpp:430
JavaWriter::writeOperations
void writeOperations(UMLClassifier *c, QTextStream &j)
Definition: javawriter.cpp:858
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Definition: umlobject.cpp:466
UMLCanvasObject::getSpecificAssocs
UMLAssociationList getSpecificAssocs(Uml::AssociationType::Enum assocType)
Definition: umlcanvasobject.cpp:61
attribute.h
JavaWriter
Definition: javawriter.h:33
a
QString a
Definition: petalnode.cpp:18
SimpleCodeGenerator::m_endl
QString m_endl
Definition: simplecodegenerator.h:78
UMLClassifier::findSuperClassConcepts
UMLClassifierList findSuperClassConcepts(ClassifierType type=ALL)
Definition: classifier.cpp:609
Uml::Visibility::toString
QString toString(Enum item, bool mnemonic)
Definition: basictypes.cpp:107
Uml::AssociationType::Association
@ Association
Definition: basictypes.h:110
CodeGenerator::formatDoc
static QString formatDoc(const QString &text, const QString &linePrefix=QLatin1String(" *"), int lineWidth=80)
Definition: codegenerator.cpp:712
uDebug
#define uDebug()
Definition: debug_utils.h:122
SimpleCodeGenerator
Definition: simplecodegenerator.h:34
JavaWriter::writeAttributeMethods
void writeAttributeMethods(UMLAttributeList &atpub, Uml::Visibility::Enum visibility, QTextStream &java)
Definition: javawriter.cpp:412
Uml::RoleType::B
@ B
Definition: basictypes.h:240
JavaWriter::writeDocumentation
void writeDocumentation(QString header, QString body, QString end, QString indent, QTextStream &java)
Definition: javawriter.cpp:472
JavaWriter::writeAttributeDecls
void writeAttributeDecls(UMLAttributeList &atpub, UMLAttributeList &atprot, UMLAttributeList &atpriv, QTextStream &java)
Definition: javawriter.cpp:371
UMLObject::doc
QString doc() const
Definition: umlobject.cpp:435
visibility
Definition: visibility.py:1
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
UMLClassifier::getAttributeList
UMLAttributeList getAttributeList() const
Definition: classifier.cpp:436
UMLPackageList
QList< UMLPackage * > UMLPackageList
Definition: umlpackagelist.h:17
UMLCanvasObject::getAggregations
UMLAssociationList getAggregations()
Definition: umlcanvasobject.cpp:412
Uml::Visibility::Enum
Enum
Definition: basictypes.h:59
JavaWriter::writeAssociationRoleDecl
void writeAssociationRoleDecl(QString fieldClassName, QString roleName, QString multi, QString doc, Uml::Visibility::Enum visib, QTextStream &java)
Definition: javawriter.cpp:530
CodeGenerator::codeGenerated
void codeGenerated(UMLClassifier *concept, bool generated)
JavaWriter::writeClass
virtual void writeClass(UMLClassifier *c)
Definition: javawriter.cpp:60
JavaWriter::writeVectorAttributeAccessorMethods
void writeVectorAttributeAccessorMethods(QString fieldClassName, QString fieldVarName, QString fieldName, QString description, Uml::Visibility::Enum visibility, Uml::Changeability::Enum change, QTextStream &java)
Definition: javawriter.cpp:633
classifier.h
UMLOperation
Definition: operation.h:25
JavaWriter::writeComment
void writeComment(const QString &text, const QString &indent, QTextStream &java, bool javaDocStyle=false)
Definition: javawriter.cpp:432
JavaWriter::javaMethodInList
static bool javaMethodInList(UMLOperation *umlOp, UMLOperationList &opl)
Definition: javawriter.cpp:795
UMLTemplateListIt
QListIterator< UMLTemplate * > UMLTemplateListIt
Definition: umltemplatelist.h:21
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
debug_utils.h
umlassociationlist.h
UMLAssociation
Sets up association information.
Definition: association.h:33
UMLObject::isUMLDatatype
bool isUMLDatatype()
Definition: umlobject.h:206
UMLCanvasObject::getCompositions
UMLAssociationList getCompositions()
Definition: umlcanvasobject.cpp:422
UMLClassifier::CLASS
@ CLASS
Definition: classifier.h:47
UMLTemplateList
QList< UMLTemplate * > UMLTemplateList
Definition: umltemplatelist.h:18
UMLTemplate
Sets up template information.
Definition: template.h:27
simplecodegenerator.h
Uml::Visibility::Private
@ Private
Definition: basictypes.h:61
CodeGenerator::forceSections
bool forceSections() const
Definition: codegenerator.cpp:775
Uml::Visibility::Protected
@ Protected
Definition: basictypes.h:62
UMLOperationList
QList< UMLOperation * > UMLOperationList
Definition: umloperationlist.h:18
umltemplatelist.h
JavaWriter::writeAssociationMethods
void writeAssociationMethods(UMLAssociationList associations, UMLClassifier *thisClass, QTextStream &java)
Definition: javawriter.cpp:568
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition: umlassociationlist.h:18
JavaWriter::writeAssociationRoleMethod
void writeAssociationRoleMethod(QString fieldClassName, QString roleName, QString multi, QString description, Uml::Visibility::Enum visib, Uml::Changeability::Enum change, QTextStream &java)
Definition: javawriter.cpp:612
SimpleCodeGenerator::findFileName
QString findFileName(UMLPackage *concept, const QString &ext)
Definition: simplecodegenerator.cpp:91
codegen_utils.h
umldoc.h
CodeGenerator::openFile
bool openFile(QFile &file, const QString &name)
Definition: codegenerator.cpp:523
UMLOperation::getSourceCode
QString getSourceCode() const
Definition: operation.cpp:507
JavaWriter::writeBlankLine
void writeBlankLine(QTextStream &java)
Definition: javawriter.cpp:1005
UMLPackage
Non-graphical information for a Package.
Definition: package.h:33
description
static const char description[]
Definition: main.cpp:37