All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.javageneration.util.UmlgConstraintOperations Maven / Gradle / Ivy

There is a newer version: 2.0.15
Show newest version
package org.umlg.javageneration.util;

import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.internal.operations.ConstraintOperations;

public class UmlgConstraintOperations extends ConstraintOperations {

	public static String getAsOcl(Constraint constraint) {
		Operation oper = (Operation) constraint.getContext();
		StringBuilder sb = new StringBuilder();
		sb.append("package ");
		sb.append(Namer.nameIncludingModel(oper.getNearestPackage()).replace(".", "::"));
		sb.append("\ncontext ");
		sb.append(UmlgOperationOperations.asOclSignature(oper));
		sb.append("\n");
		sb.append("body: ");
		sb.append(constraint.getSpecification().stringValue());
		sb.append("\n");
		sb.append("endpackage");
		return sb.toString();
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy