Map<String, String> results = new HashMap<String, String>(); String umlTypeName = type.getName(); String umlQualifiedTypeName = type.getQualifiedName();
"getTemplateParameterSubstitution: " + type.getQualifiedName() + " - " + type.getTemplateParameter()); EList<Element> elements = type.allOwnedElements(); for (Element element : elements) { if (element instanceof TemplateBinding) {
/** * Subsetting may only occur when the context of the subsetting property conforms to the context of the subsetted property. * subsettedProperty->notEmpty() implies * (subsettingContext()->notEmpty() and subsettingContext()->forAll (sc | * subsettedProperty->forAll(sp | * sp.subsettingContext()->exists(c | sc.conformsTo(c))))) */ private void validatePropertyConstraint3(Property subsettedProperty, List<Property> subsettingProperties) { for (Property subsettingProperty : subsettingProperties) { if (!subsettingProperty.subsettingContext().isEmpty()) { for (Type sc : subsettingProperty.subsettingContext()) { for (Type sp : subsettedProperty.subsettingContext()) { if (sp instanceof org.eclipse.uml2.uml.Class && !((Class) sp).getAllImplementedInterfaces().contains(sc) && !sc.conformsTo(sp)) { throw new IllegalStateException(String.format("The context of the subsetting property %s does not conform to the context of the subsetted property %s.", sp.getQualifiedName(), sc.getQualifiedName())); } } } } else { throw new IllegalStateException("???"); } } }
protected static EClassifier getEClassifier(Type type) { Resource eResource = type.eResource(); if (eResource == null || !UMLResource.UML_METAMODEL_URI.equals(String.valueOf(eResource .getURI()))) { org.eclipse.uml2.uml.Package package_ = type.getNearestPackage(); if (package_ != null) { EPackage ePackage = getEPackage(package_); if (ePackage != null) { return ePackage.getEClassifier(type.getName()); } } return null; } else { return UMLPackage.eINSTANCE.getEClassifier(type.getName()); } }
private String getOclDefaultValue(Property p) { PropertyWrapper pWrap = new PropertyWrapper(p); StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(pWrap.getOwningType().getNearestPackage()).replace(".", "::")); sb.append("\ncontext "); sb.append(pWrap.getOwningType().getName()); sb.append("::"); sb.append(getName()); sb.append("\n"); sb.append("init: "); sb.append(pWrap.getDefaultValue().stringValue()); sb.append("\n"); sb.append("endpackage"); return sb.toString(); }
public static String name(Type type) { if (type instanceof TupleType) { return "Map<String, Object>"; } else { return type.getName(); } }
StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(pWrap.getOwningType().getNearestPackage()).replace(".", "::")); sb.append("\n context "); if (pWrap.getOwner() instanceof Association) { sb.append(pWrap.getOwningType().getName()); sb.append(UmlgGenerationUtil.getCollectionInterface(pWrap)); sb.append("("); sb.append(pWrap.getType().getQualifiedName()); sb.append(")"); } else { sb.append(pWrap.getType().getQualifiedName());
@SuppressWarnings("unchecked") private void generateMethodThrowException(AST ast, Operation operation, MethodDeclaration md) { EList<Type> raisedExceptions = operation.getRaisedExceptions(); for (Type raisedExceptionType : raisedExceptions) { String umlExceptionQualifiedTypeName = raisedExceptionType .getQualifiedName(); String name = jdtHelper.createFullQualifiedTypeAsString(ast, umlExceptionQualifiedTypeName, sourceDirectoryPackageName); Name typeName = ast.newName(name); md.thrownExceptions().add(typeName); } }
.getTemplateParameter(); String name = type.getName();
protected static boolean isSubsetValid(Property subsettingProperty, Property subsettedProperty) { for (Type subsettingContext : subsettingProperty.subsettingContext()) { for (Type subsettedContext : subsettedProperty.subsettingContext()) { if (!subsettingContext.conformsTo(subsettedContext)) { return false; } } } return true; }
public static OJPathName getPathName(Type type) { String className = Namer.name(type); String fullPackageName = Namer.name(type.getNearestPackage()); OJPathName ojPathName = new OJPathName(fullPackageName + "." + className); return ojPathName; }
when(type.allOwnedElements()).thenReturn(elements); when(elements.iterator()).thenReturn(iteratorElement); when(iteratorElement.hasNext()).thenReturn(true, false);
public static String getMetaName(Type type) { if (type instanceof TupleType) { return "Map<String, Object>"; } else { return type.getName() + "Meta"; } }
sb.append(param.getName()); sb.append(": "); sb.append(param.getType().getQualifiedName()); if (count++ != parametersExceptReturn.size()) { sb.append(", "); sb.append(UmlgGenerationUtil.getCollectionInterface(returnResult)); sb.append("("); sb.append(returnResult.getType().getQualifiedName()); sb.append(")"); } else { sb.append(returnResult.getType().getQualifiedName());
: !opOwnedParameterType.conformsTo(ownedParameterType)) { : !opReturnResultType.conformsTo(returnResultType)) {
protected static Association createAssociation(Type type, boolean end1IsNavigable, AggregationKind end1Aggregation, String end1Name, int end1Lower, int end1Upper, Type end1Type, boolean end2IsNavigable, AggregationKind end2Aggregation, String end2Name, int end2Lower, int end2Upper, EClass eClass) { validateTypeAndBounds(end1Type, end1Lower, end1Upper); validateTypeAndBounds(type, end2Lower, end2Upper); org.eclipse.uml2.uml.Package package_ = type.getNearestPackage(); if (package_ == null) { throw new IllegalStateException(); } if (end1Aggregation == null) { throw new IllegalArgumentException(String.valueOf(end1Aggregation)); } if (end2Aggregation == null) { throw new IllegalArgumentException(String.valueOf(end2Aggregation)); } Association association = (Association) package_.createOwnedType(null, eClass); createAssociationEnd(type, association, end1IsNavigable, end1Aggregation, end1Name, end1Lower, end1Upper, end1Type); createAssociationEnd(end1Type, association, end2IsNavigable, end2Aggregation, end2Name, end2Lower, end2Upper, type); return association; }
String qualifiedName = type.getQualifiedName(); .getName()); } else if (qualifiedName.startsWith("XMLPrimitiveTypes::")) { //$NON-NLS-1$ eType = XMLTypePackage.eINSTANCE.getEClassifier(type .getName());
public boolean isNumber() { return getType() instanceof PrimitiveType && (getType().getName().equals("Integer") || getType().getName().equals("int") || getType().getName().equals("byte") || getType().getName().equals("Byte") || getType().getName().equals("long") || getType().getName().equals("float") || getType().getName().equals("double") || getType().getName().equals("UnlimitedNatural") || getType().getName().equals("Real")); }
@Override public void visitBefore(Property element) { //Can not get find the stereotype in the constructor as the model is not loaded yet. if (this.stereotype == null) { this.stereotype = ModelLoader.INSTANCE.findStereotype("Index"); } PropertyWrapper pWrap = new PropertyWrapper(element); if (element.isStereotypeApplied(this.stereotype) && (pWrap.isMany() || !(element.getType() instanceof DataType))) { throw new IllegalStateException(String.format("Only PrimitiveType may be indexed currently! Current element %s is a %s", new String[]{element.getQualifiedName(), element.getType().getQualifiedName()})); } }