Exemple #1
0
 private String getParameterType(UMLOperation operation, UMLElement parameter)
     throws ContractException {
   try {
     String parameterType = operation.getParameterType(parameter.getId());
     UMLElement pElement = (UMLElement) parser.getDataTypes().get(processID(parameterType));
     if (pElement != null) {
       // Eh um DataType
       if ("List".equals(pElement.getName())) {
         String setId = JDHelper.getNewId();
         this.insertSet(setId, pElement.getName(), CommonElementsPackage.JAVAVOID);
         parameterType = setId;
       } else {
         parameterType = queryType(pElement.getName());
         if (parameterType != null) {
           return parameterType;
         }
       }
     }
     return processID(operation.getParameterType(parameter.getId()));
   } catch (Exception ex) {
     throw new ContractException("Can't recover parameter type", ex);
   }
 }
Exemple #2
0
  private void insertMethodOperations(UMLClass classInst, List<UMLOperation> operationArray)
      throws ContractException {
    for (UMLOperation operation : operationArray) {
      // Return
      String typeId = processID(operation.getType());
      UMLElement element = (UMLElement) parser.getDataTypes().get(typeId);
      String operationType = getOperationType(element, typeId);
      this.insertOperation(
          operation.getId(),
          operation.getName(),
          operation.getVisibility(),
          operationType,
          classInst.getId());

      // Parameters
      for (UMLElement parameter : operation.getParameters()) {
        String parameterType = getParameterType(operation, parameter);
        this.insertParameter(
            parameter.getId(), parameter.getName(), parameterType, operation.getId());
      }
    }
  }