本文整理了Java中org.eclipse.uml2.uml.Operation.getName()
方法的一些代码示例,展示了Operation.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operation.getName()
方法的具体详情如下:
包路径:org.eclipse.uml2.uml.Operation
类名称:Operation
方法名:getName
暂无
代码示例来源:origin: org.umlg/java-generation-util
@Override
public String getName() {
return this.operation.getName();
}
代码示例来源:origin: org.eclipse.ocl/uml
result = operation.getName();
代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml
referredLoop : for (Operation referred : getReferreds()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(referred.getName())
: name.equals(referred.getName())))
continue referredLoop;
EList<Parameter> ownedParameterList = referred.getOwnedParameters();
代码示例来源:origin: org.andromda.bootstrap.metafacades/andromda-metafacades-emf-uml22
public int compare(final Operation operation1, final Operation operation2)
{
int rtn = operation1.getName().compareTo(operation2.getName());
if (rtn == 0)
{
rtn = operation1.getOwnedParameters().size() - operation1.getOwnedParameters().size();
if (rtn == 0)
{
int index = 0;
for (Parameter parameter : operation1.getOwnedParameters())
{
rtn = parameter.getName().compareTo(operation2.getOwnedParameters().get(index).getName());
if (rtn != 0)
{
break;
}
index++;
}
}
}
return rtn;
}
}
代码示例来源:origin: org.eclipse.ocl/uml
ownedOperationLoop : for (Operation ownedOperation : getOwnedOperations()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(ownedOperation.getName())
: name.equals(ownedOperation.getName())))
continue ownedOperationLoop;
EList<Parameter> ownedParameterList = ownedOperation
代码示例来源:origin: org.eclipse.ocl/uml
ownedOperationLoop : for (Operation ownedOperation : getOwnedOperations()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(ownedOperation.getName())
: name.equals(ownedOperation.getName())))
continue ownedOperationLoop;
EList<Parameter> ownedParameterList = ownedOperation
代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml
redefinedOperationLoop : for (Operation redefinedOperation : getRedefinedOperations()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(redefinedOperation.getName())
: name.equals(redefinedOperation.getName())))
continue redefinedOperationLoop;
EList<Parameter> ownedParameterList = redefinedOperation
代码示例来源:origin: org.andromda.metafacades/andromda-metafacades-emf-uml22
public int compare(final Operation operation1, final Operation operation2)
{
int rtn = operation1.getName().compareTo(operation2.getName());
if (rtn == 0)
{
rtn = operation1.getOwnedParameters().size() - operation1.getOwnedParameters().size();
if (rtn == 0)
{
int index = 0;
for (Parameter parameter : operation1.getOwnedParameters())
{
rtn = parameter.getName().compareTo(operation2.getOwnedParameters().get(index).getName());
if (rtn != 0)
{
break;
}
index++;
}
}
}
return rtn;
}
}
代码示例来源:origin: org.umlg/java-generation-ocl
/**
* Callback for an OperationCallExp visit.
* <p/>
* Look at the source to determine operator ( -> or . )
*
* @param oc the operation call expression
* @return string
*/
@Override
protected String handleOperationCallExp(OperationCallExp<Classifier, Operation> oc, String sourceResult, List<String> argumentResults) {
String name = oc.getReferredOperation().getName();
return OclOperationExpEnum.from(name).setOJClass(this.ojClass).handleOperationExp(oc, sourceResult, argumentResults);
}
代码示例来源:origin: org.umlg/java-generation-util
sb.append(oper.getName());
sb.append("(");
List<Parameter> parametersExceptReturn = getParametersExceptReturn(oper);
代码示例来源:origin: org.umlg/java-generation
@Override
public void visitBefore(Operation oper) {
Element operOwner = oper.getOwner();
if (oper.getBodyCondition() != null && !oper.isQuery()) {
throw new IllegalStateException(String.format("Operation %s on %s has a bodyCondition but is not a query.",
new Object[] { oper.getName(), ((NamedElement) operOwner).getName() }));
}
OJAnnotatedClass ojClass;
if (operOwner instanceof Interface) {
ojClass = findOJClass((Interface) operOwner);
addOperSignature(ojClass, oper);
} else if ((operOwner instanceof org.eclipse.uml2.uml.Class) || (operOwner instanceof Enumeration)) {
ojClass = findOJClass((org.eclipse.uml2.uml.Classifier) operOwner);
OJAnnotatedOperation ojOper = addOperSignature(ojClass, oper);
if (oper.isQuery()) {
addQueryBody(ojClass, ojOper, oper);
}
} else {
throw new IllegalStateException("Operations are only supported on Interfaces and Classes, not on " + operOwner.toString());
}
}
代码示例来源:origin: org.umlg/java-generation-ocl
/**
* Wraps the source expression in a try catch block. If
* OclIsInvalidException is caught return true else false
*/
@Override
public String handleOperationExp(OperationCallExp<Classifier, Operation> oc, String sourceResult, List<String> argumentResults) {
if (argumentResults.size() != 1) {
throw new IllegalStateException("oclAsType operation must have one argument!");
}
List<OCLExpression<Classifier>> arguments = oc.getArgument();
Type argumentType = arguments.get(0).getType();
String operationName = oc.getReferredOperation().getName();
OJAnnotatedOperation oper = new OJAnnotatedOperation(operationName + this.ojClass.countOperationsStartingWith(operationName), UmlgClassOperations.getPathName(argumentType));
oper.addParam("sourceResult", "Object");
this.ojClass.addToOperations(oper);
oper.setVisibility(OJVisibilityKind.PRIVATE);
if (sourceResult.equals("self")) {
sourceResult = "this";
}
oper.getBody().addToStatements("return ((" + argumentResults.get(0) + ")" + "sourceResult)");
if (sourceResult.equals("self")) {
sourceResult = "this";
}
return oper.getName() + "(" + sourceResult + ")";
}
}
代码示例来源:origin: org.umlg/java-generation
private OJAnnotatedOperation addOperSignature(OJAnnotatedClass ojClass, Operation oper) {
OperationWrapper operWrapper = new OperationWrapper(oper);
OJAnnotatedOperation ojOper = new OJAnnotatedOperation(oper.getName(), operWrapper.getReturnParamPathName());
ojOper.addToParameters(operWrapper.getOJParametersExceptReturn());
ojClass.addToOperations(ojOper);
return ojOper;
}
代码示例来源:origin: crowdcode-de/KissMDA
/**
* Generaate the Java methods from UML.
*
* @param clazz
* the UML class
* @param ast
* the JDT Java AST
* @param td
* TypeDeclaration JDT
*/
public void generateMethods(Classifier clazz, AST ast, TypeDeclaration td) {
// Get all methods for this clazz
// Only for this class without inheritance
EList<Operation> operations = clazz.getOperations();
for (Operation operation : operations) {
logger.log(Level.FINE, "Operation: " + operation.getName());
MethodDeclaration md = ast.newMethodDeclaration();
md.setName(ast.newSimpleName(operation.getName()));
// Parameters, exclude the return parameter
generateMethodParams(ast, td, operation, md);
// Return type
generateMethodReturnType(ast, td, operation, md);
// Throws Exception
generateMethodThrowException(ast, operation, md);
// Generate Javadoc
generateMethodJavadoc(ast, operation, md);
// Generate Method template params
generateMethodTemplateParams(ast, operation, md);
}
}
代码示例来源:origin: org.umlg/java-generation-ocl
/**
* Wraps the source expression in a try catch block. If
* OclIsInvalidException is caught return true else false
*/
@Override
public String handleOperationExp(OperationCallExp<Classifier, Operation> oc, String sourceResult, List<String> argumentResults) {
if (argumentResults.size() != 1) {
throw new IllegalStateException("oclIsTypeOf operation must have one argument!");
}
Type sourceType = oc.getSource().getType();
String operationName = oc.getReferredOperation().getName();
OJAnnotatedOperation oper = new OJAnnotatedOperation(operationName + this.ojClass.countOperationsStartingWith(operationName), new OJPathName("Boolean"));
oper.addParam(sourceResult, UmlgClassOperations.getPathName(sourceType));
this.ojClass.addToOperations(oper);
oper.setVisibility(OJVisibilityKind.PRIVATE);
oper.getBody().addToStatements("return " + sourceResult + " instanceof " + argumentResults.get(0));
if (sourceResult.equals("self")) {
sourceResult = "this";
}
return oper.getName() + "(" + sourceResult + ")";
}
}
代码示例来源:origin: org.umlg/java-generation-ocl
/**
* Wraps the source expression in a try catch block. If
* OclIsInvalidException is caught return true else false
*/
@Override
public String handleOperationExp(OperationCallExp<Classifier, Operation> oc, String sourceResult, List<String> argumentResults) {
if (argumentResults.size() != 1) {
throw new IllegalStateException("oclIsKindOf operation must have one argument!");
}
Type sourceType = oc.getSource().getType();
String operationName = oc.getReferredOperation().getName();
OJAnnotatedOperation oper = new OJAnnotatedOperation(operationName + this.ojClass.countOperationsStartingWith(operationName), new OJPathName("Boolean"));
oper.addParam(sourceResult, UmlgClassOperations.getPathName(sourceType));
this.ojClass.addToOperations(oper);
oper.setVisibility(OJVisibilityKind.PRIVATE);
oper.getBody().addToStatements("return " + argumentResults.get(0) + ".class.isAssignableFrom(" + sourceResult + ".getClass())");
if (sourceResult.equals("self")) {
sourceResult = "this";
}
return oper.getName() + "(" + sourceResult + ")";
}
}
代码示例来源:origin: crowdcode-de/KissMDA
when(iteratorOperation.hasNext()).thenReturn(true, false);
when(iteratorOperation.next()).thenReturn(operation);
when(operation.getName()).thenReturn("calculateMe");
when(operation.getType()).thenReturn(operationType);
when(operation.getRaisedExceptions()).thenReturn(raisedExceptions);
代码示例来源:origin: org.umlg/java-generation-ocl
/**
* Wraps the source expression in a try catch block. If
* OclIsInvalidException is caught return true else false
*/
@Override
public String handleOperationExp(OperationCallExp<Classifier, Operation> oc, String sourceResult, List<String> argumentResults) {
if (!argumentResults.isEmpty()) {
throw new IllegalStateException("oclIsInvalid operation can not have arguments!");
}
String operationName = oc.getReferredOperation().getName();
OJAnnotatedOperation oper = new OJAnnotatedOperation(operationName + this.ojClass.countOperationsStartingWith(operationName), new OJPathName("Boolean"));
this.ojClass.addToOperations(oper);
oper.setVisibility(OJVisibilityKind.PRIVATE);
OJTryStatement ojTryStatement = new OJTryStatement();
ojTryStatement.getTryPart().addToStatements("return " + sourceResult + " == null");
// ojTryStatement.getTryPart().addToStatements("return false");
ojTryStatement.setCatchParam(new OJParameter("e", UmlgGenerationUtil.umlgOclIsInvalidException.getCopy()));
this.ojClass.addToImports(UmlgGenerationUtil.umlgOclIsInvalidException.getCopy());
ojTryStatement.getCatchPart().addToStatements("return true");
oper.getBody().addToStatements(ojTryStatement);
return oper.getName() + "()";
// return ojTryStatement.toJavaString();
}
}
代码示例来源:origin: org.eclipse.ocl/uml
String operName = getReferredOperation().getName();
代码示例来源:origin: org.umlg/java-generation-ocl
/**
* Wraps the source expression in a try catch block. If
* OclIsInvalidException is caught return true else false
*/
@Override
public String handleOperationExp(OperationCallExp<Classifier, Operation> oc, String sourceResult, List<String> argumentResults) {
if (!argumentResults.isEmpty()) {
throw new IllegalStateException("oclIsUndefined operation can not have arguments!");
}
String operationName = oc.getReferredOperation().getName();
Type sourceType = oc.getSource().getType();
OJAnnotatedOperation oper = new OJAnnotatedOperation(operationName + this.ojClass.countOperationsStartingWith(operationName), new OJPathName("Boolean"));
if (!(sourceType instanceof PrimitiveType) && !(sourceType instanceof Enumeration) && sourceType instanceof DataType) {
oper.addParam(StringUtils.uncapitalize(sourceType.getName()), DataTypeEnum.getPathNameFromDataType((DataType) sourceType));
} else if (sourceType instanceof PrimitiveType) {
oper.addParam(StringUtils.uncapitalize(sourceType.getName()), UmlgPropertyOperations.umlPrimitiveTypeToJava(sourceType));
} else {
oper.addParam(StringUtils.uncapitalize(sourceType.getName()), UmlgClassOperations.getPathName(sourceType));
}
this.ojClass.addToOperations(oper);
oper.setVisibility(OJVisibilityKind.PRIVATE);
OJTryStatement ojTryStatement = new OJTryStatement();
ojTryStatement.getTryPart().addToStatements("return " + StringUtils.uncapitalize(sourceType.getName()) + " == null");
ojTryStatement.setCatchParam(new OJParameter("e", UmlgGenerationUtil.umlgOclIsInvalidException.getCopy()));
this.ojClass.addToImports(UmlgGenerationUtil.umlgOclIsInvalidException.getCopy());
ojTryStatement.getCatchPart().addToStatements("return true");
oper.getBody().addToStatements(ojTryStatement);
return oper.getName() + "(" + sourceResult + ")";
}
}
内容来源于网络,如有侵权,请联系作者删除!