umbrello/umbrello
javacodeaccessormethod.cpp
Go to the documentation of this file.
30 JavaCodeAccessorMethod::JavaCodeAccessorMethod (CodeClassField * field, CodeAccessorMethod::AccessorType type)
36 JavaClassifierCodeDocument* jccd = dynamic_cast<JavaClassifierCodeDocument*>(field->getParentDocument());
44 void JavaCodeAccessorMethod::setAttributesOnNode (QDomDocument & doc, QDomElement & blockElement)
75 text += QLatin1String("if (") + fieldName + QLatin1String(".size() < ") + QString::number(maxOccurs) + QLatin1String(") {") + endLine + indent;
80 text += indent + QLatin1String("System.err.println(\"ERROR: Cant add") + fieldType + QLatin1String(" to ") + fieldName + QLatin1String(", minimum number of items reached.\");") + endLine + QLatin1Char('}') + endLine;
98 text += QLatin1String("if (") + fieldName + QLatin1String(".size() >= ") + QString::number(minOccurs) + QLatin1String(") {") + endLine + indent;
103 text += indent + QLatin1String("System.err.println(\"ERROR: Cant remove") + fieldType + QLatin1String(" from ") + fieldName + QLatin1String(", minimum number of items reached.\");") + endLine + QLatin1Char('}') + endLine;
163 headerText = QLatin1String("Add an object of type ") + objectType + QLatin1String(" to the List ") + fieldName + endLine + getParentObject()->doc() + endLine + QLatin1String("@return void");
168 headerText = QLatin1String("Get the value of ") + fieldName + endLine + getParentObject()->doc() + endLine + QLatin1String("@return the value of ") + fieldName;
171 methodName = QLatin1String("get") + Codegen_Utils::capitalizeFirstLetter(fieldType) + QLatin1String("List");
173 headerText = QLatin1String("Get the list of ") + fieldName + endLine + getParentObject()->doc() + endLine + QLatin1String("@return List of ") + fieldName;
179 headerText = QLatin1String("Remove an object of type ") + objectType + QLatin1String(" from the List ") + fieldName + endLine + getParentObject()->doc();
185 headerText = QLatin1String("Set the value of ") + fieldName + endLine + getParentObject()->doc() + endLine;
198 setStartMethodText(strVis + QLatin1Char(' ') + methodReturnType + QLatin1Char(' ') + methodName + QLatin1String(" (") + methodParams + QLatin1String(") {"));
void setType(AccessorType type)
Set the type of accessor method this is.
Definition: codeaccessormethod.cpp:72
void setEndMethodText(const QString &value)
Set the ending text that finishes this method after the body is printed.
Definition: codemethodblock.cpp:66
void setStartMethodText(const QString &value)
Set the starting text that begins this method before the body is printed.
Definition: codemethodblock.cpp:58
virtual void updateContent()
This is the method called from within syncToparent() to update the body of the method.
Definition: javacodeaccessormethod.cpp:60
class JavaClassifierCodeDocument A Java UMLClassifier Code Document.
Definition: javaclassifiercodedocument.h:32
void setText(const QString &text)
Set the value of m_text The actual text of this code block.
Definition: textblock.cpp:80
QString getNewLineEndingChars() const
Utility function to get the actual characters.
Definition: codegenerationpolicy.cpp:248
AccessorType getType()
Utility method to get the value of the parent object of the parent classifield.
Definition: codeaccessormethod.cpp:64
CodeClassField * getParentClassField()
Get the value of m_parentclassfield.
Definition: codeaccessormethod.cpp:40
class CodeGenerationPolicy This class describes the code generation policy for this project...
Definition: codegenerationpolicy.h:29
void update()
Must be called before this object is usable.
Definition: javacodeaccessormethod.cpp:202
ClassifierCodeDocument * getParentDocument()
Get the parent Code Document.
Definition: codeparameter.cpp:133
int minimumListOccurances()
Find the minimum number of things that can occur in an association If mistakenly called on attribute ...
Definition: codeclassfield.cpp:328
Definition: basictypes.h:58
JavaCodeAccessorMethod(CodeClassField *field, CodeAccessorMethod::AccessorType type)
Constructor.
Definition: javacodeaccessormethod.cpp:30
QString number(int n, int base)
virtual void setAttributesFromNode(QDomElement &element)
Set the class attributes of this object from the passed element node.
Definition: javacodeaccessormethod.cpp:52
QString capitalizeFirstLetter(const QString &string)
Return the input string with the first letter capitalized.
Definition: codegen_utils.cpp:421
Definition: codeaccessormethod.h:32
bool isEmpty() const
Definition: codeaccessormethod.h:32
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Set attributes of the node that represents this class in the XMI document.
Definition: codeaccessormethod.cpp:123
int maximumListOccurances()
Find the maximum number of things that can occur in an association If mistakenly called on attribute ...
Definition: codeclassfield.cpp:352
QString toString(Enum item, bool mnemonic)
Convert Visibility item into QString representation.
Definition: basictypes.cpp:99
Definition: codeaccessormethod.h:20
Definition: codeaccessormethod.h:32
CodeGenerationPolicy * commonPolicy() const
Returns the default code generation policy.
Definition: uml.cpp:2219
class JavaCodeDocumentation A Java code comment.
Definition: javacodedocumentation.h:27
Definition: basictypes.h:57
virtual void setAttributesFromNode(QDomElement &element)
Set the class attributes of this object from the passed element node.
Definition: codeaccessormethod.cpp:137
Uml::Visibility::Enum getAttributeAccessorScope()
Get the value of m_attributeAccessorScope.
Definition: codegenerationpolicy.cpp:384
Uml::Visibility::Enum getVisibility() const
Utility method to get the value of parent object scope.
Definition: codeparameter.cpp:89
Definition: javacodeclassfield.h:21
Definition: codeaccessormethod.h:32
virtual void updateMethodDeclaration()
This is the method called from within syncToparent().
Definition: javacodeaccessormethod.cpp:118
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Set attributes of the node that represents this class in the XMI document.
Definition: javacodeaccessormethod.cpp:44
Definition: basictypes.h:61
void setComment(CodeComment *object)
Set the Comment object.
Definition: codeblockwithcomments.cpp:38
QString getText() const
Get the value of m_text The actual text of this code block.
Definition: textblock.cpp:99
Definition: basictypes.h:59
static QString getIndentation()
Get how much a single "level" of indentation will actually indent.
Definition: textblock.cpp:182
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.