本文整理了Java中org.eclipse.uml2.uml.Operation.getOwnedComments()
方法的一些代码示例,展示了Operation.getOwnedComments()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operation.getOwnedComments()
方法的具体详情如下:
包路径:org.eclipse.uml2.uml.Operation
类名称:Operation
方法名:getOwnedComments
暂无
代码示例来源:origin: crowdcode-de/KissMDA
/**
* Generate Javadoc for UML Operation.
*
* @param ast
* AST tree JDT
* @param operation
* UML Operation - Method
* @param md
* MethodDeclaration
*/
public void generateMethodJavadoc(AST ast, Operation operation,
MethodDeclaration md) {
EList<Comment> comments = operation.getOwnedComments();
for (Comment comment : comments) {
Javadoc javadoc = ast.newJavadoc();
generateJavadoc(ast, comment, javadoc);
md.setJavadoc(javadoc);
}
}
代码示例来源:origin: crowdcode-de/KissMDA
@SuppressWarnings("unchecked")
@Test
public void testGenerateMethodJavadoc() {
AST ast = AST.newAST(AST.JLS3);
ast.newCompilationUnit();
TypeDeclaration td = ast.newTypeDeclaration();
td.setInterface(true);
Modifier modifier = ast
.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
td.modifiers().add(modifier);
td.setName(ast.newSimpleName("Company"));
MethodDeclaration md = ast.newMethodDeclaration();
md.setName(ast.newSimpleName("calculateAge"));
Operation operation = mock(Operation.class,
Answers.RETURNS_DEEP_STUBS.get());
EList<Comment> comments = mock(EList.class,
Answers.RETURNS_DEEP_STUBS.get());
Iterator<Comment> commentIterator = mock(Iterator.class);
Comment comment = mock(Comment.class, Answers.RETURNS_DEEP_STUBS.get());
when(operation.getOwnedComments()).thenReturn(comments);
when(comments.iterator()).thenReturn(commentIterator);
when(commentIterator.hasNext()).thenReturn(true, false);
when(commentIterator.next()).thenReturn(comment);
when(comment.getBody()).thenReturn(
"Comment...\nTest\n@author: Lofi Dewanto");
interfaceGenerator.generateMethodJavadoc(ast, operation, md);
assertEquals(
"/** \n * Comment...\n * Test\n * @author: Lofi Dewanto\n */\nvoid calculateAge();\n",
md.toString());
}
内容来源于网络,如有侵权,请联系作者删除!