IOMClass Class

Listing 1. The basic implementation of the IOMClass class has just two attributes: name (the name of the class) and stereotype (the UML associated stereotype).

package com.ftp.codegenerator;

import java.util.*;

public class IOMClass {

  private String name = "";
  private String stereotype = "";

  private ArrayList attributes = new ArrayList();
  private ArrayList operations = new ArrayList();

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getStereotype() {
    return stereotype;
  }

  public void setStereotype(String stereotype) {
    this.stereotype = stereotype;
  }

  public ArrayList getAttributes() {
    return attributes;
  }

  public void addAttribute(IOMAttribute attribute) {
    attributes.add(attribute);
    attribute.setClassParent(this);
  }

  public ArrayList getOperations() {
    return operations;
  }

  public void addOperation(IOMOperation operation) {
    operations.add(operation);
    operation.setClassParent(this);
  }

  public ArrayList getMyAssociations() {
    ArrayList ret = new ArrayList();
    for (int i = 0; i < 
      IOMController.getAssociations().size() ; i++)
IOMAssociation ass = (
  IOMAssociation) IOMController.getAssociations().
  get(i); 
if(ass.getStartRole().getClassInvolved().
  getName().equals(this.name)
    ||ass.getEndRole().getClassInvolved().
    getName().equals(this.name))
    ret.add(ass);
    }
    return ret;
  }
}