umbrello: JavaCodeGenerator Class Reference

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

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
JavaCodeGenerator Class Reference

`#include <javacodegenerator.h>`

Inheritance diagram for JavaCodeGenerator:

## Public Member Functions
| JavaCodeGenerator ()
virtual | ~JavaCodeGenerator ()
void | setCreateANTBuildFile (bool buildIt)
bool | getCreateANTBuildFile ()
bool | getAutoGenerateAttribAccessors ()
bool | getAutoGenerateAssocAccessors ()
virtual CodeViewerDialog * | getCodeViewerDialog (QWidget *parent, CodeDocument *doc, Settings::CodeViewerState &state)
JavaCodeGenerationPolicy * | getJavaPolicy ()
CodeDocument * | newClassifierCodeDocument (UMLClassifier *classifier)
Uml::ProgrammingLanguage::Enum | language () const
virtual QStringList | defaultDatatypes () const
virtual QStringList | reservedKeywords () const
Public Member Functions inherited from AdvancedCodeGenerator
| AdvancedCodeGenerator ()
virtual | ~AdvancedCodeGenerator ()
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)
virtual void | writeCodeToFile ()
virtual void | writeCodeToFile (UMLClassifierList &list)
void | setIncludeHeadings (bool i)
bool | includeHeadings () const
void | setHeadingFileDir (const QString &)
QString | headingFileDir () const
void | setForceDoc (bool f)
bool | forceDoc () const
void | setSectionCommentPolicy (CodeGenerationPolicy::WriteSectionCommentsPolicy 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 void | createDefaultStereotypes ()

## Static Public Member Functions
static QString | getListFieldClassName ()
static QString | fixTypeName (const QString &string)
Static Public Member Functions inherited from CodeGenerator
static QString | cleanName (const QString &name)
static QString | formatDoc (const QString &text, const QString &linePrefix=QStringLiteral(" *"), int lineWidth=80)
static QString | formatFullDocBlock (const QString &text, const QString &blockHeader=QStringLiteral("/* "), const QString &blockFooter=QStringLiteral(" */"), const QString &linePrefix=QStringLiteral(" *"), int lineWidth=80)
static QString | formatSourceCode (const QString &code, const QString &indentation)
static void | findObjectsRelated (UMLClassifier *c, UMLPackageList &cList)

## Protected Member Functions
JavaANTCodeDocument * | newANTCodeDocument ()
Protected Member Functions inherited from AdvancedCodeGenerator
virtual void | initFromParentDocument ()
void | connectSlots ()
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 ()

## Private Attributes
bool | m_createANTBuildFile

## Additional Inherited Members
Public Types inherited from CodeGenerator
enum | GenerationState { Generated , Failed , Skipped }
Public Slots inherited from AdvancedCodeGenerator
virtual void | checkAddUMLObject (UMLObject *obj)
virtual void | checkRemoveUMLObject (UMLObject *obj)
Public Slots inherited from CodeGenerator
virtual void | syncCodeToDocument ()
Signals inherited from CodeGenerator
void | codeGenerated (UMLClassifier *classifier, bool generated)
void | codeGenerated (UMLClassifier *classifier, CodeGenerator::GenerationState result)
void | showGeneratedFile (const QString &filename)
Protected Attributes inherited from CodeGenerator
QHash< QString, CodeDocument * > | m_codeDocumentDictionary
bool | m_applyToAllRemaining
UMLDoc * | m_document

## Constructor & Destructor Documentation

## ◆ JavaCodeGenerator()

JavaCodeGenerator::JavaCodeGenerator | ( |  | ) |

Constructor.

## ◆ ~JavaCodeGenerator()

JavaCodeGenerator::~JavaCodeGenerator | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ defaultDatatypes()

QStringList JavaCodeGenerator::defaultDatatypes | ( |  | ) | const
| virtual

Adds Java's primitives as datatypes.

Returns
  a string list of Java primitives

Reimplemented from CodeGenerator.

## ◆ fixTypeName()

QString JavaCodeGenerator::fixTypeName | ( | const QString & | string | ) |
| static

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".

## ◆ getAutoGenerateAssocAccessors()

bool JavaCodeGenerator::getAutoGenerateAssocAccessors | ( |  | ) |

A utility method to get the javaCodeGenerationPolicy()->getAutoGenerateAssocAccessors() value.

## ◆ getAutoGenerateAttribAccessors()

bool JavaCodeGenerator::getAutoGenerateAttribAccessors | ( |  | ) |

A utility method to get the javaCodeGenerationPolicy()->getAutoGenerateAttribAccessors() value.

## ◆ getCodeViewerDialog()

CodeViewerDialog * JavaCodeGenerator::getCodeViewerDialog | ( | QWidget * | parent,
|  | CodeDocument * | doc,
|  | Settings::CodeViewerState & | state )
| virtual

Get the editing dialog for this code document. In the Java version, we make the ANT build file also available.

Reimplemented from AdvancedCodeGenerator.

## ◆ getCreateANTBuildFile()

bool JavaCodeGenerator::getCreateANTBuildFile | ( |  | ) |

Get the value of m_createANTBuildFile

Returns
  the value of m_createANTBuildFile

## ◆ getJavaPolicy()

JavaCodeGenerationPolicy * JavaCodeGenerator::getJavaPolicy | ( |  | ) |

Utility function for getting the java code generation policy.

## ◆ getListFieldClassName()

QString JavaCodeGenerator::getListFieldClassName | ( |  | ) |
| static

Get the list variable class name to use. For Java, we have set this to "Vector".

## ◆ language()

Uml::ProgrammingLanguage::Enum JavaCodeGenerator::language | ( |  | ) | const
| virtual

Return "Java".

Returns
  programming language identifier

Implements CodeGenerator.

## ◆ newANTCodeDocument()

JavaANTCodeDocument * JavaCodeGenerator::newANTCodeDocument | ( |  | ) |
| protected

Create the codeblock that will represent the class declaration for this classifier.

Create ANT code document.

Returns
  JavaANTCodeDocument object

## ◆ newClassifierCodeDocument()

CodeDocument * JavaCodeGenerator::newClassifierCodeDocument | ( | UMLClassifier * | classifier | ) |
| virtual

Create a classifier code document.

Parameters

  classifier | the UML classifier

Returns
  the created classifier code document

Implements AdvancedCodeGenerator.

## ◆ reservedKeywords()

QStringList JavaCodeGenerator::reservedKeywords | ( |  | ) | const
| virtual

Get list of reserved keywords.

Returns
  the string list of reserved keywords for Java

Reimplemented from CodeGenerator.

## ◆ setCreateANTBuildFile()

void JavaCodeGenerator::setCreateANTBuildFile | ( | bool | buildIt | ) |

Set the value of m_createANTBuildFile

Parameters

  buildIt | the new value of m_createANTBuildFile

## Member Data Documentation

## ◆ m_createANTBuildFile

bool JavaCodeGenerator::m_createANTBuildFile
| private

The documentation for this class was generated from the following files:

- umbrello/codegenerators/java/javacodegenerator.h
- umbrello/codegenerators/java/javacodegenerator.cpp